On Apr 20, 2010, at 1:33 PM, John wrote:
Yup, you're definitely right Daniel. Everyone's comment on the subject was very helpful and gave us all insight into the internals of Clojure. I guess the key points to learn in our case is: 1- Clojure supports primitives, but only when you ask for them (by casting) 2- Clojure cannot unbox the boxed recur arguments which causes a problem when the arguments of loop are primitive. This looks like a bug to me. The code posted by Armando can be expanded to include boxed versions of primitive types, why the code doesn't include such a check ? Will Clojure's class hierarchy be a blocker ? Again, I'm fairly new to Clojure and cannot answer these questions. I'm only throwing them at you guys hoping someone will clarify them.
Clojure could of course auto-unbox on recur to primitive local, but it doesn't, for a reason. If you are using primitive locals it is because you are looking for the speed of primitive operations. If by the point you recur you have a boxed number, you have made a mistake somewhere in preserving primitive ops. Were the compiler to auto-unbox, you'd never find out. So, should you get this error, you can't ignore it, and you definitely shouldn't just add a coercion in recur. Instead, find the spot where you lost primitiveness and fix it.
Rich -- 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