Don't think there is a best practice for your case in particular.
The issue is that js->cli is built on top of protocols to allow converting
custom JS types to CLJS types. Which makes it extensible for the price of
checking protocols. In your case you are converting JSON which cannot have
custom types, so a custom converter only checking for the very few possible
JSON types would "fix" your problem (and would probably be a lot faster).
The case can be made that cljs-ajax should not be using js->clj when
converting JSON, maybe even add a json->clj to cljs.core.
The sentinel is the "safest" solution but impacts the performance of
*everyone*, so we should be doing more benchmarks on more platforms before
deciding anything. Benchmarks and Votes on the Jira Issue would help to
push this along.
On Tuesday, October 18, 2016 at 10:21:21 AM UTC+2, John Szakmeister wrote:
> On Tue, Oct 18, 2016 at 2:59 AM, Thomas Heller <th.h...@gmail.com
> > While this issue can be very confusing you will hardly ever run into it
> > following best practices. As David suggested using a custom js->clj here
> > would prevent the issue and is probably the best course of action
> > regardless.
> Which best practices? Is there a good place to read about them? I've
> not seen anything that would have steered me away from this problem.
> In fact, I've seen quite the opposite: js->clj appears to be *the* way
> FWIW, I did end up putting something together that was able to do what
> I needed, but it could have easily gone a different direction.
> js->clj was being called in a library that I'm using (cljs-ajax), and
> it, fortunately, had a knob that I could turn to just get the raw json
> back out without running anything through js->clj. Had the knob been
> missing, I think the solution would have been much more painful as I'd
> either have to fork and maintain a copy of the library, migrate to a
> different library, or write my own to replace it with. :-(
> I also like the sentinel idea. I hope some version of your patch is
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to firstname.lastname@example.org
Note that posts from new members are moderated - please be patient with your
To unsubscribe from this group, send email to
For more options, visit this group at
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.