Patch welcome for 1. As far as 2 I myself see no way to make that work without considering a numerics overhaul.
On Sun, Jan 6, 2013 at 7:13 PM, Thomas Heller <th.hel...@gmail.com> wrote: > Hey, > > I'm writing a Clojure Webapp with a CLJS Frontend and expected to be able > to cljs.reader/read-string everything I pr-str'd on the CLJ side. That > however does not work for defrecords and BigDecimals (1.1M) . > > 1. defrecord > > In CLJ I can: > > (ns dummy) > (defrecord Foo [bar]) > (pr-str (Foo. 1)) ; => "#dummy.Foo{:bar 1}" > > in CLJS however this will print as > > "#Foo{:bar 1}" > > missing the Namespace. I found an old > post<https://groups.google.com/d/msg/clojure/YSkPd4zQTKQ/757Wd4Ex8pAJ>about > this but no other information. > > Also when I pr-str this record in CLJ and cljs.reader/read-string it in > CLJS it fails with "Could not find tag parser for dummy.Foo in ("inst" > "uuid" "queue") ", although the defrecord exists and is in the same ns > (actually a cljsbuild crossover). I figured out that I can > (cljs.reader/register-tag-parser! 'dummy.Foo make-foo) but thats seems > faulty. I read about EDN and understand why the reader would think its > reading a Tag but I can do read-string in CLJ just fine. Shouldnt both > sides be equal here? > > 2. BigDecimals: > > I understand that JavaScript has no BigDecimals and I can live with > js/parseFloat on the Client for now, however is there any way I can hint > the CLJS printer to print "1.1" as "1.1M"? > > On the Topic of EDN: How would I "tag" a value in CLJ(S) to print {:foo > "bar"} as #my/tag {:foo "bar"}? The docs only talk about data_readers.clj. > > The answers probably lie in the sources, but I hope somebody here has a > quick answer. ;) > > Cheers, > /thomas > > PS: I'd actually prefer using "tagged" literals instead of the defrecord > constructor form since I dont trust anything coming from the client even it > looks like clojure data. Is there some protocol I can implement for the > record and have it print as tagged instead? For CLJ and CLJS? :) > > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.