3 ms·
Something like `(uuid "550e8400-e29b-41d4-a716-446655440000")` can't be carried around as data whereas `#uuid "550e8400-e29b-41d4-a716-446655440000"` can be. T
by zaph0d 14y ago
Something like `(uuid "550e8400-e29b-41d4-a716-446655440000")` can't be carried around as data whereas `#uuid "550e8400-e29b-41d4-a716-446655440000"` can be.
Think about data interchange between Clojure & ClojureScript.
- gosub 14y agoI do not understand what do you mean by "carried around as data", a s-expr is data. Could you give me an example where you can't use the first form?
- spacemanaki 14y agoI think the issue is that in order to use the first form, you would need to eval the s-expr after reading it, which is potentially dangerous and fragile. But also, ClojureScript doesn't have run-time eval. Of course, you could interpret the s-expr as some kind of tagged list (or more likely use a vector like [:uuid "550..."]) and instead of eval-ing check the first element etc, but at that point, why not have an extensible reader do that for you?
- cemerick 14y agoOf course `(uuid "…")` can be carried around as data; it's a list containing a symbol and a string, just like `#uuid "…"` is a tag and a string. The difference is that the latter is evaluated at read-time with constrained semantics, rather than requiring the full force and latitude of `eval`. i.e. definitely helpful for data interchange between Clojure implementations (and read-time shenanigans in general), and a big improvement over the depths of #= and such.
- zaph0d 14y ago+1.