Fork me on GitHub
#clojure-uk
<
2021-02-02
>
jiriknesl07:02:19

Good morning

djm08:02:27

👋

alexlynham10:02:42

imagine a lot of it will be if you need to interop with node libs basically (which you will for anything nontrivial)

folcon11:02:34

True, but there is a question of how much of that will end up being necessary? I mean some of the compiled examples are quite impressive... http://teavm.org/gallery.html For example Invaders appears to be a 3d space invaders game with pretty nice looking graphics...

alexlynham11:02:15

yeah, i just mean that IRL few/none of us are making games but we prob want node libs :) but then i'm biased, the JVM is more painful to me than node

alexlynham11:02:39

even if i prefer JVM clj, i find the JVM insanely painful to work with compared to node

folcon11:02:31

That's fair, I tend to think of them as having different tradeoffs, on the one hand the jvm clj side leaks a bit more stuff that I'd like when I'm doing interop and not in a good way, because most java things you get back are pretty opaque vs js. The js repl side is always really fiddly to get working correctly and I can't count the number of times where getting a nice build / dev env working in cljs is just frustrating. However once it all works, it's a lot easier to just get productive in... Assuming you don't try and change something in the environment, say trying to work in a lambda in my case, then it's lots of fiddling trying to get the build working again...

alexlynham11:02:43

mmm i don't really use teh repl in cljs which makes me sad :(

alexlynham11:02:15

also pervasive async etc just imo makes a repl semi useless cos i can't deref at will like i can on jvm

mccraigmccraig11:02:32

better (fn [v] (let [r (atom nil)] (.handle v (fn [succ err] (reset! r (or err succ)))) r))

folcon11:02:12

There are ways I've gotten a nice repl experience working in cljs, but as I said, really fragile and only works on a project by project basis >_<...

alexlynham11:02:44

i know i know craig, but you know what i mean... it feels harder

alexlynham11:02:18

and you know me, i'm a hippie and how a language feels when i write it is probably the most important thing

alexlynham11:02:52

then again i guess my current project is structured as nano services that can be called as if they are regular functions

mccraigmccraig11:02:57

getting it set up is harder for sure, once it's actually going it's no longer harder, especially with a node-repl

alexlynham11:02:04

so that's probably why i'm happy to just write unit tests

alexlynham11:02:27

in a larger codebase that wasn't lots of 40 line services, i'd probably be sobbing, begging for a repl

alexlynham11:02:44

tbf, shadow makes pain much lower these days

rickmoynihan12:02:59

I find the browser repl in cljs works quite well these days; cljs tooling definitely isn’t quite as strong as on the clj side, so some cider middlewares etc don’t work. Also cljs isn’t as polished as clojure, and has some more edge cases associated with it. I’m not sure the pervasive async is a problem I’ve had much though. Most functions are pure and just working on a reagent state atom etc. You can drive the state/atom at the REPL and have the views update, or just eval the pure functions in your editor buffer etc.

alexlynham12:02:48

ah, i'm working on node/serverless fns generally so browser repl can't help me :( then again i am getting stung daily by no runtime typechecking in typescript, argh

rickmoynihan12:02:25

I find the JVM is very straightforward to work with… other than clj startup time etc, I don’t really have many problems with it… I certainly find node more problematic.

alexlynham12:02:52

it is stable, that is true

alexlynham12:02:24

but at the same time running hundreds of db tests in seconds on node from a cold start makes the jvm look tired and old

rickmoynihan12:02:53

The JVM or clojure on the JVM?

alexlynham12:02:45

clojure on the jvm, not done much else on it besides a bit o' scala

alexlynham12:02:08

but it's the jvm cold start and whatnot that eats up that initial time

alexlynham12:02:24

compiling all our typescript takes milliseconds

rickmoynihan12:02:54

Well not so much these days… JVM startup time isn’t actually that much these days, it’s about 200ms for hello world; which is gonna be an order of magnitude worse than node, but not a big deal in dev. It’ll not have warmed up either, so may still be noticeably a bit slower; but likely not that significant in most dev workflows, unless you’re stopping and starting the vm a lot. It’s really clojure that is slow to start, as it needs to load and compile namespaces and initialise vars etc.

rickmoynihan12:02:19

Tricks like this can make a significant difference though: https://clojure.org/guides/dev_startup_time

folcon12:02:06

Hmm, not seen that, ok, that's super interesting. Will have to see how much of a difference that makes!

rickmoynihan12:02:58

I wouldn’t go so far as to say it makes these usages quick… but it does make them a lot quicker, at the cost of some complexity

alexlynham13:02:38

yeah that makes sense

folcon19:02:02

Something to test 😃...

alexlynham12:02:40

or, i should say, makes it feel that way at least

mccraigmccraig12:02:43

right up until the moment when you need to do tens of thousands of db ops per second on prod 😬

alexlynham12:02:13

ah yeah, we'd horizontally scale the lambdas themselves, luckily we're a regular http app, not a stream/websockets situation 👀

alexlynham12:02:26

i mean if i was doing stream data i'd be back to jvm clj in a shot

mccraigmccraig12:02:50

ha, i don't think i'm being fair... i suspect our routing would run just fine on node (given a suitable kafka-streams equivalent), although the raw compute of producing effects would be slower than on a warm jvm

alexlynham12:02:53

yeah probably true

alexlynham12:02:25

outside of a VPC, with a well-packaged lambda your cold start would be pretty low, but probably still pretty large compared to the latency you're used to

alexlynham12:02:13

since our front end is PWA-like and partially statically built, we could get away with a pretty bad pathological case before it became an issue

Ben Hammond16:02:50

first Dustin Diamond and now Sir Thomas Moore 😢

jasonbell16:02:25

@mccraigmccraig right up until the moment when you need to do tens of thousands of db ops per second on prod << Spoken like a true Cassandra survivor ! lol

mccraigmccraig16:02:48

@jasonbell i am on the verge of being able to outsource all our cassandra ops... i am confident it will feel very good

Conor17:02:04

It's ironic it's called Cassandra because everyone believes it will cause misfortune

mccraigmccraig18:02:40

ha, well i've been using it for a while, and i'm still a fan