sci 2022-02-19

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?

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

hmm, does location metadata change that potentially?

potentially yes, since MetaFns aren't normal JS functions

shows up like this

and is of type MetaFn

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

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

what config are you using for SCI?

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

turn what off?

attaching location metadata?

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 :(

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

since those are stripped before attaching metadata to a function

that js namespace is no longer used

I should really remove it

just use the settings I recommend earlier

and then it should work

or read using SCI's reader

which is also exposed

you can add additional edamame options to it

yeah those settings work, thanks!

🙌 1

I really wish I could change this in edamame itself

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

that's also the clojure default

maybe I can introduce a :clojure-defaults true option

which will do those things

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

👍 1

and :end-location false also recommended?

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

Oh very nice!

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

you can change the reader function for #js I think

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

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

you can :exclude those

will do, thanks

but macros should work normally?

maybe I can work on that monday if you need help

it depends on how those macros are defined

sure, that’d be great

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