cherry

borkdude 2022-07-26T17:41:24.203769Z

Made a lot of progress today: • case • multi-arity functions • interop improvements • fixed examples for Firefox and Safari (by adding shim) ◦ https://twitter.com/borkdude/status/1551985597765615616

ray 2022-07-26T19:15:44.618729Z

@raymcdermott has joined the channel

ray 2022-07-26T19:19:20.919879Z

@borkdude maybe I'm missing something ... is there a simple case of how one would use 🍒 from js?

ray 2022-07-26T19:22:03.983359Z

assume I exposed a function that returned JSON called get-fun-data .... I guess it would be exposed as getFunData and if I called it from ES6 ... hey presto .... the js gets some JSON

ray 2022-07-26T19:23:24.294329Z

[ you might guess that I'm trying to make a CLJ / CLJS library that has interop with various languages without having to write much in those languages ]

ray 2022-07-26T19:23:46.240149Z

[ CLJS in this case ]

chromalchemy 2022-07-26T19:32:57.870909Z

@chromalchemy has joined the channel

borkdude 2022-07-26T20:30:34.175789Z

@raymcdermott You can compile a file like this:

echo '{}' > package.json
npm install cherry-cljs
npx cherry-cljs foo.cljs
and this produces a file foo.mjs which you can then consume from JS

borkdude 2022-07-26T20:31:03.815049Z

get-fun-data is available as get_fun_data currently

borkdude 2022-07-26T20:31:25.746489Z

(just the munged symbol)

borkdude 2022-07-26T20:34:01.089919Z

Note that cherry is experimental and not stable, but with that in mind, feel free to try it out and report issues

borkdude 2022-07-26T20:38:37.624989Z

I do agree that get-fun-data -> getFunData is nicer, so I'll have to write a better munge function myself maybe ;)

borkdude 2022-07-26T20:40:26.930629Z

Or maybe functions can have some metadata like (defn {:export 'getFunData} get-fun-data []) or so

👍🏼 1
borkdude 2022-07-26T20:44:56.179149Z

of course you can also do:

(def getFunData get-fun-data)

💯 1
ray 2022-07-26T20:45:45.282259Z

Thanks for the tips, looks another new pathway!!

🚀 1
jeffparker 2022-07-26T23:22:28.508419Z

@jeffparker has joined the channel