I have a bunch of prismatic schemas that all reference cljs.core.UUID but I can change them. I am always a little surprised and concerned when previously working code suddenly stops, and I had no idea how to progress after (type id) printed out something like an object ;-).
@jaen on Slack pointed out https://github.com/tonsky/datascript/issues/110 which seems relevant. > On 25 Sep 2015, at 11:41 PM, Ivan Willig <[email protected]> wrote: > > That would be what I would except from my reading of the transit-cljs > code. Is there a reason you need your UUID's to be cljs.core.UUIDs > instead of a com.cognitect.transit.types.UUID ? > > If you need to check if a value was a UUID you could always write > something like, > > (defn uuid? [u] (instance? com.cognitect.transit.types.UUID u)) > Ivan Willig > > > > On Fri, Sep 25, 2015 at 6:03 PM, Colin Yates <[email protected]> wrote: >> Definitely something weird going on. If I don’t use transit and just use >> pr-str/read-string then it works fine. >> >>> On 25 Sep 2015, at 10:41 PM, Ivan Willig <[email protected]> wrote: >>> >>> I believe this is because the `type` function returns a type's >>> constructor function in JavaScript parlance. You can find `type` here. >>> >>> https://github.com/clojure/clojurescript/blob/2fa41e7969d22f72876122d2250baf4ef936e6e9/src/main/cljs/cljs/core.cljs#L250-L254 >>> >>> Under the hood, transit-cljs uses transit-js as you can see here, >>> https://github.com/cognitect/transit-cljs/blob/master/src/cognitect/transit.cljs#L110 >>> >>> And the constructor function for a UUID in transit-js looks like >>> https://github.com/cognitect/transit-js/blob/620906704f9f6904745895878ad3228607836d31/src/com/cognitect/transit/types.js#L248-L252. >>> >>> I would guess that you are getting back the >>> com.cognitect.transit.types.UUID type and not the clojurescript >>> version of a UUID. When you create a UUID in the repl you are of >>> course getting the cljs version UUID. >>> >>> However, I just started to understand transit so I maybe wrong. >>> >>> Hope this helps. >>> Ivan Willig >>> >>> >>> >>> On Fri, Sep 25, 2015 at 5:19 PM, Colin Yates <[email protected]> wrote: >>>> First, this is almost certainly my fault but I am scratching my head how >>>> to proceed. >>>> >>>> I am using transit (json) to send messages from the server to the client >>>> and it is working great except my UUIDs don’t seem to be coming across: >>>> >>>> cljs.user=> id >>>> #uuid "9e7200f4-419c-461e-a9e5-f6b07f8dcd8f" >>>> cljs.user=> (type id) >>>> #object[Function "function (high, low) { >>>> this.high = high; >>>> this.low = low; >>>> this.hashCode = -1; >>>> }"] >>>> >>>> previously (type id) would return cljs.core/UUID. Transit is working >>>> elsewhere - it is converting sequences and keywords etc., but every UUID >>>> has the above type. >>>> >>>> If I go to a fig wheel REPL and create a new UUID then it correctly >>>> reports the type as "cljs.core/UUID". >>>> >>>> I have no idea how to proceed or how to interpret the result of (type id). >>>> >>>> Any pointers? >>>> >>>> Thanks. >>>> >>>> -- >>>> Note that posts from new members are moderated - please be patient with >>>> your first post. >>>> --- >>>> You received this message because you are subscribed to the Google Groups >>>> "ClojureScript" group. >>>> To unsubscribe from this group and stop receiving emails from it, send an >>>> email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/group/clojurescript. >>> >>> -- >>> Note that posts from new members are moderated - please be patient with >>> your first post. >>> --- >>> You received this message because you are subscribed to the Google Groups >>> "ClojureScript" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/clojurescript. >> >> -- >> Note that posts from new members are moderated - please be patient with your >> first post. >> --- >> You received this message because you are subscribed to the Google Groups >> "ClojureScript" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/clojurescript. > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
