This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-27
Channels
- # announcements (2)
- # aws (17)
- # babashka (13)
- # beginners (84)
- # calva (46)
- # chlorine-clover (40)
- # cider (19)
- # clojure (27)
- # clojure-australia (1)
- # clojure-europe (84)
- # clojure-nl (2)
- # clojure-uk (49)
- # clojurescript (65)
- # core-async (6)
- # cryogen (1)
- # cursive (11)
- # datomic (13)
- # etaoin (3)
- # jackdaw (5)
- # jobs (2)
- # kaocha (34)
- # minimallist (6)
- # off-topic (17)
- # pathom (2)
- # pedestal (11)
- # re-frame (8)
- # reagent (5)
- # rewrite-clj (19)
- # shadow-cljs (30)
Why does pr-str
on a node yield something like <token: foo>
rather than something which can be consumed by read-string
? Not a big deal, but it can be confusing for tooling (like the Flow Storm Debugger) that seem to rely on pr-str
for sending results.
By comparison, the result I get from the socket REPL using clover in VSCode looks like:
#rewrite_cljc.node.token.TokenNode {:value foo, :string-value "foo"}
I think @UG1C3AD5Z might have asked about that too, many moons ago. I think @UG1C3AD5Z was trying out REBL and details were maybe being hidden by this behaviour.
The VSCode rulest is what you get when printing in a defrecord. It seems rewrite-clj defines print-methods for its types here: https://github.com/lread/rewrite-cljc-playground/blob/cc8ded71f1ca056d4851f4664754e0e004e985ad/src/rewrite_cljc/node/protocols.cljc#L100 Maybe those print-methods can be removed, not sure. It doesn't seem to be a good idea to define a print-method which prints something which cannot be read.
Right. Or if there's something useful about the <>
representation, maybe have another method that outputs that. Probably not a priority right now, but might be nice to clean up at some point.
I’m not sure why the original author of rewrite-clj made that decision, and he has moved on to other things and not available. My original position was to avoid all unnecessary breaking changes when migrating to rewrite-cljc, but am now revisiting for things that just don’t make good sense.
> By default, pr and prn print in a way that objects can be read by the reader It seems to go against the spirit of pr/prn
Emitting something with a reader tag is probably a better way and then define data readers
I wonder if it was just to support the use of clojure.test
, and save some keystrokes when defining tests. It's the only obvious place I find the <>
notation used.
The reader-tag approach seems like a good alternative for that case.
I do have a set of popular projects that use rewrite-clj that I have tested against in the past. I could see if any of them are relying on this and in what way. I’ll raise an issue in rewrite-cljc to have a look at this.
@lee Just saw this via #announcements : https://github.com/liquidz/antq/blob/222addc76766319f2f6fe73491abc53c6f8d2b0a/deps.edn#L11