This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-22
Channels
- # 100-days-of-code (1)
- # beginners (51)
- # carry (1)
- # cider (10)
- # clojure (71)
- # clojure-conj (4)
- # clojure-dev (9)
- # clojure-italy (3)
- # clojure-nl (2)
- # clojure-russia (8)
- # clojure-uk (16)
- # clojurescript (42)
- # cursive (4)
- # datomic (2)
- # emacs (8)
- # figwheel-main (7)
- # fulcro (20)
- # hyperfiddle (5)
- # jobs (2)
- # off-topic (16)
- # om-next (4)
- # onyx (9)
- # powderkeg (1)
- # re-frame (8)
- # reagent (17)
- # reitit (41)
- # robots (6)
- # rum (1)
- # shadow-cljs (54)
- # testing (3)
- # tools-deps (19)
Saw a post on twitter where people figured that clojure is similar to ruby :(
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.
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
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
I like it that you can patch a libraries function if thereās a bug in it, until your PR gets merged š
you canāt patch Clojure itself (anymore) though, itās compiled with direct linking
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
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.
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
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.
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.
recent example of where I needed to bypass āprivateā: https://github.com/borkdude/who-follows-me/blob/master/src/who_follows_me/sentry.clj#L55