This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-17
Channels
- # announcements (1)
- # babashka (26)
- # beginners (28)
- # biff (8)
- # calva (45)
- # cider (62)
- # clara (3)
- # clj-kondo (34)
- # cljfx (1)
- # clojure (72)
- # clojure-belgium (1)
- # clojure-canada (13)
- # clojure-conj (2)
- # clojure-dev (3)
- # clojure-europe (19)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-uk (8)
- # clojurescript (10)
- # clr (36)
- # core-logic (13)
- # cursive (2)
- # datalevin (2)
- # datomic (23)
- # fulcro (13)
- # graphql (23)
- # instaparse (1)
- # introduce-yourself (4)
- # jobs (1)
- # jobs-discuss (13)
- # lsp (30)
- # luminus (7)
- # malli (2)
- # off-topic (57)
- # polylith (13)
- # portal (5)
- # reagent (32)
- # reitit (6)
- # remote-jobs (1)
- # shadow-cljs (25)
- # xtdb (12)
I am wondering about safety of clojure.edn/read-string
reading through https://cljs.github.io/api/clojure.edn/
it looks like
• read-eval is not a thing in cljs
• If I wanted extra data-readers then I would have to explicitly pass them in
• therefore read-string
is safe by default in cljs
Is that a correct assumption.
My data source is supposed to be trusted.
but I would like to be careful
Hello all. Trying to use tagged literals using data_readers.cljc
, and getting different results when running from CLJ vs. CLJS. Here is a minimal repro: https://gist.github.com/dimovich/161c0ee8dfdedbd7c3fcf6f11024f6f4
clojure.core/read-string
works differently, if I'm not mistaken it doesn't care about custom data readers. It works only because it's being smart about records.
Your reader function is incorrect in general, and the CLJS code shows it - it ends up calling (circle {:p [0 0], :r 3})
, which is why you end up seeing a map within the record with CLJS.
Correction to the above - clojure.core/read-string
doesn't care about the reader when the tag has .
in its name. If there are dots, the tag is considered to be a record.
Right, there's a discussion here: https://clojurians.slack.com/archives/C03S1KBA2/p1672761348177329
@U2FRKM4TW Thank you. Was wondering why in Clojure the record was initialized without calling the constructor fn.