clojurescript

maybenot 2024-12-01T13:23:49.586279Z

Seems like clojurescript 1.10.758 is the last version which react-native (using Hermes) could work properly with 1.10.844 and above gives me weird syntax errors, which is really unfortunate given that 844 gave (:require [npm-lib$SubLib) syntax (maybe it's related? 😅) Did anyone encounter this problem?

dnolen 2024-12-02T12:53:34.409019Z

re: RN. We found Hermes to be unreliable (when I was at Vouch), and that had nothing to do w/ ClojureScript, we ran into problems w/ patterns in various JS dependencies. Disabling removed those issues.

👀 1
dnolen 2024-12-02T12:53:40.701239Z

Hermes never seemed like a good idea.

dnolen 2024-12-02T12:56:59.961279Z

lots of things around tooling could be better - but my anecdote of doing React Native for 5 years - the most frustrating things and productivity black holes were not ClojureScript - but JavaScript.

dnolen 2024-12-02T12:57:58.885509Z

and Android/iOS stuff. So really React Native itself.

dnolen 2024-12-02T12:58:34.529609Z

the most important question to ask is - whether the RN thing is better than doing it twice (for us not practical, so we eat the other problems)

dnolen 2024-12-02T13:01:31.737179Z

re: not using REPL w/ ClojureScript seems unidiomatic to me. I can't say much about nREPL, but dropping that indirection removed most of my own struggles years ago.

maybenot 2024-12-02T15:02:16.314399Z

Thanks @dnolen really appreciate the response! Seems like react-native people are pushing Hermes further and further, especially as a default option in tooling and inside marketing materials, interestingly all evidence I’ve found showed that performance difference is marginal at best.. Re: Doing twice: for me RN with clojurescript is mostly about dev ux, both kotlin with notebooks (also can write once) and Swift with playgrounds and previews provide a subpar experience compared to repl, especially on moderate size project, but the entry/setup for cljs is challenging

maybenot 2024-12-02T15:21:51.582099Z

Also interested in what struggles nrepl brings? Anomalies in behaviour?

thheller 2024-12-02T15:43:47.942189Z

nrepl is just weird and much more complicated than a basic streaming REPL. although streaming REPLS are much more limited in the features they can provide, so most editors tend to rely on nrepl for those features or completely bail and don't provide them for socket REPLs. calva/cider rely heavily on nrepl so you'd miss out on a lot without it. Cursive not so much, so less noticable

1
thheller 2024-12-01T14:04:19.177819Z

hermes just doesn't support es6+ syntax. At least it used to complain about a const use in some goog file

thheller 2024-12-01T14:04:48.302259Z

you can set :compiler-options {:output-feature-set :es5} in the build config when using shadow-cljs

thheller 2024-12-01T14:04:59.218759Z

can't remember what the option was in regular cljs.main configs

maybenot 2024-12-01T14:25:09.915719Z

Yes, read about this problem, but strange thing here is that swapping clojurescript version makes it work, seems like it shouldn’t?

thheller 2024-12-01T14:26:55.194999Z

it doesn't. but swapping the clojurescript version also swaps the dependent closure library version

maybenot 2024-12-01T14:27:44.401119Z

FWIW I could make rn-rf-shadow template work, but failed to replicate it using latest expo tooling 🫠 will give it another spin today For now the only thing which worked was figwheel, but unfortunately with old clojurescript

thheller 2024-12-01T14:28:33.666639Z

I have never used react-native myself, so no clue what might have changed

thheller 2024-12-01T14:28:42.407129Z

if you give me the error I can make suggestions though

maybenot 2024-12-01T14:33:07.037499Z

Me neither 🙃 But as someone who spent a lot of time developing natively, I feel like modern react native finally offers something really good especially bundled with clojure, so trying hard to make it work, cycling between different set of tooling (bare cljs, krell, figwheel, shadow)

maybenot 2024-12-01T14:34:14.628719Z

But so far just dropping to js was the easiest option 🥲 unfortunately no atoms, reagent, datascript, core async, etc..

thheller 2024-12-01T14:34:57.209009Z

🤷

maybenot 2024-12-01T16:36:11.257269Z

Almost got it working with shadow! Not sure about this error sometimes popping up after jack-in from Calva (NOBRIDGE) ERROR REPL Invoke Exception [ReferenceError: Property 'cider' doesn't exist] {"hash": null, "arr": [{"hash": null, "cljs$lang$protocolmask$partition0$": <tel:2153775105|2153775105>, "cljs$lang$protocol_mask$partition1$": 4096, "fqn": "type", "name": "type", "ns": null}, {"hash": null, "cljs$lang$protocolmask$partition0$": <tel:2153775105|2153775105>, "cljs$lang$protocol_mask$partition1$": 4096, "fqn": "repl/invoke", "name": "invoke", "ns": "repl"}, {"hash": null, "cljs$lang$protocolmask$partition0$": <tel:2153775105|2153775105>, "cljs$lang$protocol_mask$partition1$": 4096, "fqn": "name", "name": "name", "ns": null}, "<eval>", {"hash": null, "cljs$lang$protocolmask$partition0$": <tel:2153775105|2153775105>, "cljs$lang$protocol_mask$partition1$": 4096, "fqn": "js", "name": "js", "ns": null}, "cider.nrepl.inlined.deps.suitable.v0v6v2.suitable.js_introspection.property_names_and_types.call(null, (function (){var this$ = this; return this$; })(),\"a\")", {"hash": null, "cljs$lang$protocolmask$partition0$": <tel:2153775105|2153775105>, "cljs$lang$protocol_mask$partition1$": 4096, "fqn": "source", "name": "source", "ns": null}, "(cider.nrepl.inlined.deps.suitable.v0v6v2.suitable.js-introspection/property-names-and-types (this-as this this) \"a\")", {"hash": null, "cljs$lang$protocolmask$partition0$": <tel:2153775105|2153775105>, "cljs$lang$protocol_mask$partition1$": 4096, "fqn": "source-map-json", "name": "source-map-json", "ns": null}, "{\"version\":3,

maybenot 2024-12-01T17:04:36.526869Z

In all other ways - fantastic, I even have :default inside imports and don’t need lib$sublib syntax 🔥 Not sure about es6 and Hermes, didn’t see any problems but also didn’t explicitly set es5 mode

thheller 2024-12-01T17:05:56.984619Z

that error looks like cider trying to eval clj code in a cljs repl. or maybe it just hasn't done a proper require before trying to use that code. maybe ask the #cider people. I don't use emacs myself, so not sure what that all does

maybenot 2024-12-01T17:10:15.872439Z

Ah, it was Calva in vscode, so probably I messed something up switching between shadow-cljs and shadow-cljs + deps edn jack ins.. Will try one more fresh sample haha

maybenot 2024-12-01T17:25:43.920639Z

Philosophical question: I know, most ordinary clojurescript setups are simpler than RN, but still, given that both modern js and js tooling aren’t that bad, why is clojurescript worth it for people? Asked myself this question, trying to figure out the correct setup, and seems like the most straightforward answer is repl, feeling bad without this direct link to the running program, besides, probably absence of syntax, simplicity, and some unique libs, like datascript. Interested in what others think.

p-himik 2024-12-01T17:28:19.274129Z

I'd suggest searching here and e.g. on Reddit for similar questions. As you can imagine, something like this has been asked more than once. :) All I can say is that I myself almost never use CLJS REPL. And usually just to quickly test some behavior as compared to CLJ.

maybenot 2024-12-01T17:31:54.607899Z

I know that and also asked this before 😛, specifically interested in fresh answers, given that both js and cljs are moving (and reddit looks almost dead and probably for good huh) Agree that cljs repl feels less useful that clj, but the good thing is that you can often repl out the same code in clj repl and then pass back to cljs

p-himik 2024-12-01T17:39:33.772359Z

CLJ[S] Reddit isn't dead, it's just slow. > both js and cljs are moving The latter doesn't move fast enough to generate any new answers. But maybe you could get some answers from new people.

maybenot 2024-12-01T17:42:25.581219Z

Agree on dynamics, but probably the pace of js (was associated with smth bad before, probably not so much now, idk) could change opinions for old people. Anyway, appreciate the answer 🤝

danieroux 2024-12-01T18:22:20.615579Z

clojure.core That's why CLJS is worth it for me.

💯 1