I'm not so sure about this, but is it possible to throw an exception when dividing by zero for example? I don't know if exceptions are the right way of dealing with this at all, but at least this would be bringing things more in line with Clojure.
On Jan 27, 10:03 pm, David Nolen <dnolen.li...@gmail.com> wrote: > In this > branchhttps://github.com/clojure/clojurescript/compare/master...checked-ari..., > I've implemented one possible approach to checked arithmetic for > ClojureScript. In Clojure this means checking for overflow. In JavaScript a > much more common source of error is type coercion from the arithmetic > operators as well as the introduction of Infinity and NaN. > > These changes would prevent the production of NaN and Infinity at least > from within ClojureScript itself. Also operations like: > > (+ 1 2 "3") > > fail instead of producing > > "33" > > Of course such changes would impose a performance hit. You can currently > toggle the behavior with the following macro: > > (set-unchecked-arithmetic! true) > > This is useful when writing performance sensitive code. > > Feedback, improvements appreciated. > > David -- 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