clojure-uk

A place for people in the UK, near the UK, visiting the UK, planning to visit the UK or just vaguely interested to randomly chat about things (often vi and emacs, occasionally clojure). More general the #ldnclj
jiriknesl 2021-02-02T07:59:19.114100Z

Good morning

alexlynham 2021-02-02T08:26:37.114200Z

morning

thomas 2021-02-02T08:31:17.114400Z

mogge

djm 2021-02-02T08:31:27.114600Z

👋

2021-02-02T08:35:05.114800Z

Morning

mccraigmccraig 2021-02-02T08:46:18.115Z

måning

dharrigan 2021-02-02T09:05:45.115300Z

Morning!

2021-02-02T09:13:33.115600Z

Morn'

alexlynham 2021-02-02T10:28:42.115700Z

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

2021-02-02T11:05:34.117600Z

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...

alexlynham 2021-02-02T11:07:15.117900Z

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

alexlynham 2021-02-02T11:07:39.118Z

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

2021-02-02T11:12:31.121700Z

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...

alexlynham 2021-02-02T11:30:43.121800Z

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

alexlynham 2021-02-02T11:31:15.121900Z

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

mccraigmccraig 2021-02-02T11:34:20.122900Z

@alex.lynham (fn [v] (.then v pr))

2021-02-02T11:35:12.123800Z

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 >_<...

mccraigmccraig 2021-02-02T11:47:32.123900Z

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

alexlynham 2021-02-02T11:47:44.124100Z

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

alexlynham 2021-02-02T11:48:18.124500Z

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

alexlynham 2021-02-02T11:48:52.124900Z

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

mccraigmccraig 2021-02-02T11:48:57.125100Z

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

alexlynham 2021-02-02T11:49:04.125200Z

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

alexlynham 2021-02-02T11:49:27.125300Z

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

alexlynham 2021-02-02T11:49:44.125400Z

tbf, shadow makes pain much lower these days

2021-02-02T12:21:59.131300Z

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.

alexlynham 2021-02-02T12:23:48.132700Z

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

2021-02-02T12:25:25.133200Z

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.

alexlynham 2021-02-02T12:26:52.133300Z

it is stable, that is true

alexlynham 2021-02-02T12:27:24.133400Z

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

alexlynham 2021-02-02T12:27:40.133500Z

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

mccraigmccraig 2021-02-02T12:29:43.134100Z

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

alexlynham 2021-02-02T12:33:13.134200Z

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

alexlynham 2021-02-02T12:33:26.134300Z

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

2021-02-02T12:35:53.134700Z

The JVM or clojure on the JVM?

mccraigmccraig 2021-02-02T12:37:50.136300Z

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

alexlynham 2021-02-02T12:38:53.136400Z

yeah probably true

alexlynham 2021-02-02T12:39:25.136500Z

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

alexlynham 2021-02-02T12:40:13.136600Z

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

alexlynham 2021-02-02T12:48:45.136700Z

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

alexlynham 2021-02-02T12:49:08.136900Z

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

alexlynham 2021-02-02T12:49:24.137100Z

compiling all our typescript takes milliseconds

2021-02-02T12:51:54.137300Z

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.

2021-02-02T12:53:19.137700Z

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

2021-02-02T12:55:06.137900Z

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

2021-02-02T12:56:58.138100Z

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

alexlynham 2021-02-02T13:44:38.138300Z

yeah that makes sense

2021-02-02T16:48:50.139Z

first Dustin Diamond and now Sir Thomas Moore 😢

jasonbell 2021-02-02T16:50:25.139500Z

@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

mccraigmccraig 2021-02-02T16:59:48.140500Z

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

Conor 2021-02-02T17:07:04.140600Z

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

mccraigmccraig 2021-02-02T18:11:40.141200Z

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

2021-02-02T19:56:02.141300Z

Something to test 😃...