Cheers Francis and ducky ! Updated the blog post accordingly.
-magnus On Friday, 7 August 2015 23:13:34 UTC+2, Francis Avila wrote: > On Friday, August 7, 2015 at 10:45:47 AM UTC-5, ducky wrote: > > Great post. > > > > Regarding boolean type hinting, I believe this is down to an optimisation > > done while emitting the javascript and not by the closure compiler. > > Correct. There is an internal function/macro cljs.core/truth_ which > implements the boolean semantics of clojure (i.e., undefined, nil and false > are falsey, rest truthy). The ^boolean type hint allows the cljs compiler to > avoid a emitting a call to truth_ when it knows that the value will have the > same truthiness in both clojure and javascript. > > Clojure and js truthiness differ for 0, "" (empty-string) and NaN: these are > all truthy in cljs and falsy in js. The boolean hint is really for true > boolean values (true or false), but if you are desperate for performance > somewhere you can cheat if you know it won't be any of these values. -- 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.
