Fork me on GitHub
#sci
<
2022-02-19
>
mkvlr12:02:23

it seems that sci when targeting the browser, unlike ClojureScript, doesn’t create plain js functions when using fn , is that correct? Can I access the underlying fn if I need to pass it to a js lib as a callback?

borkdude12:02:52

@mkvlr it does return plain functions like CLJS, or at least, it should

mkvlr12:02:34

hmm, does location metadata change that potentially?

borkdude12:02:19

potentially yes, since MetaFns aren't normal JS functions

mkvlr12:02:20

shows up like this

mkvlr12:02:31

and is of type MetaFn

borkdude12:02:34

but defaults in SCI will take care of this, unless you use custom

borkdude12:02:52

Check scittle, nbb, etc: those all work correctly with JS interop

borkdude12:02:05

what config are you using for SCI?

mkvlr12:02:13

guess I can turn off this for edamame and that should do it then

borkdude12:02:38

turn what off?

mkvlr12:02:58

attaching location metadata?

borkdude12:02:24

I think edamame should have an option to read using clojure defaults. in the beginning I made the mistake of using different keywords for rows and columns. SCI itself has fixed this, but I would prefer to fix this in edamame, but this would be breaking :(

borkdude12:02:51

but if you use :row-key :line :col-key :column it should already work

borkdude12:02:01

since those are stripped before attaching metadata to a function

borkdude12:02:04

that js namespace is no longer used

borkdude12:02:10

I should really remove it

borkdude12:02:34

just use the settings I recommend earlier

borkdude12:02:37

and then it should work

borkdude12:02:56

or read using SCI's reader

borkdude12:02:01

which is also exposed

borkdude12:02:11

you can add additional edamame options to it

mkvlr12:02:13

yeah those settings work, thanks!

🙌 1
borkdude12:02:44

I really wish I could change this in edamame itself

mkvlr12:02:53

:location? seq? also doens’t hurt I guess?

borkdude12:02:14

that's also the clojure default

borkdude12:02:23

maybe I can introduce a :clojure-defaults true option

borkdude12:02:28

which will do those things

borkdude12:02:40

SCI still adds metadata to symbols when reading code, but I also want to get rid of that

👍 1
mkvlr12:02:21

and :end-location false also recommended?

borkdude12:02:46

if you're not using that, then it's good

borkdude12:02:50

Oh very nice!

mkvlr12:02:14

btw some interesting things came up with Clerk’s sci forms inside clojure namespaces… Wondering if we can support #js in quoted forms

borkdude12:02:55

you can change the reader function for #js I think

mkvlr12:02:56

did you do anything to applied-science.js-interop to work in sci? Tried sci/copy-ns earlier but it chocked

borkdude12:02:20

check nbb which has a SCI config for it. copy-ns chokes on protocols and maybe other stuff

borkdude12:02:26

you can :exclude those

mkvlr12:02:30

will do, thanks

mkvlr12:02:40

but macros should work normally?

borkdude12:02:56

maybe I can work on that monday if you need help

borkdude12:02:12

it depends on how those macros are defined

mkvlr12:02:22

sure, that’d be great

borkdude15:02:16

@mkvlr perhaps already make an issue so I can start on it Monday morning