Fork me on GitHub
#off-topic
<
2018-09-22
>
kulminaator13:09:04

Saw a post on twitter where people figured that clojure is similar to ruby :(

kulminaator13:09:44

Having seen ruby projects that are just layers of monkeypatches all over the place with dirty states on the left and right... I think clojure is anything but that.

henrik14:09:02

Given a fuzzy enough point of view, anything is similar to anything else.

šŸ˜› 4
dominicm16:09:44

But it's dynamic! And has keywords!

dominicm16:09:06

Javascript is like Java, but you don't have to put types when you define variables.

vemv18:09:25

I've worked at a Clojure project with more monkeypatches than any Rails project I've ever touched Similarly, Rails embraces statelessness in the http req/res cycle, and usage of instance variables (`@foo = ...`) tends to be equivalent to Clojure's let or atom

jsa-aerial18:09:30

monkeypatching in Clojure?!? How'd you/they manage that??? Seriously, you would have to really work to make that happen. Not actually sure how that would be done

vemv18:09:14

tldr a characterization of Rails from 10y ago doesn't help anybody involved šŸ™‚

šŸ‘ 4
borkdude18:09:31

I like it that you can patch a libraries function if thereā€™s a bug in it, until your PR gets merged šŸ˜‰

borkdude18:09:56

you canā€™t patch Clojure itself (anymore) though, itā€™s compiled with direct linking

andy.fingerhut18:09:56

I believe even with direct linking, you can alter-var-root Vars in clojure.core, and it affects the code run by anything that isn't direct linked with Clojure, which unless you specifically ask for it, your app code is not direct linked.

borkdude18:09:35

true, but itā€™s limited. if you alter-var-root e.g. get to throw it wonā€™t automatically get you that behavior in all destructuring code

andy.fingerhut19:09:07

But calls between functions in clojure.core are direct linked with each other, and so would not be affected by such alter-var-root's. I believe some orgs build their own Clojure JARs from locally modified source code, too, which is effective even for calls between functions in core.

borkdude19:09:20

I have used alter-var-root as well to patch something until itā€™s merged. Alternatively you can overwrite an entire namespace from a library. You can get to ā€œprivateā€ things fairly easy in Clojure. So far Iā€™ve liked that more than hated it.

mfikes19:09:07

Yeah, this flexibility greatly reduces the stress of developing a solution in this language when you have a deadline. You can so easily monkey-patch, use private vars, etc. and defer truly fixing the root issues to a point in time of your choosing.