On Jun 20, 2010, at 12:57 PM, Luke VanderHart wrote:
I've been reading this thread, and there's good arguments being made both ways - I've just been reading with interest. But after seeing the factorial function that won't compile without hints/casts, I feel I have to speak up. I wrote a book on Clojure. It's a short book. That's because Clojure is simple. It's dynamically typed, and everything "just works." In the current version of Clojure, you can use numbers all day long without worrying about types. Type hinting and casting is an advanced topic - I think it should stay that way. It seems evident that some sort of compromise will be made on this question. That's fine. I genuinely could go either way. But whatever combination of features makes it into the final decision, they should absolutely, vehemently not *require* knowing how to type hint or cast just to get something basic to compile (as in the factorial example). That is antithetical to the whole concept of dynamic typing. Having exceptions thrown on overflow is ok with me - that's something programmers are used to putting up with, I think, as long as the rules are clear. I don't care what the rules are, as long as they're simple to understand and based on a few axioms. If integers are bounded, that's fine, if they automatically promote, that's fine, as long as the rules are clear. If there's a separate set of math functions which do or don't promote, that's fine. But don't, please don't, do anything that would mean I'd have to explain the intricacies of primitives, boxing, hinting and casting in an "Intro to Clojure" course. As much as humanely possible, that should be reserved for the "Performance coding in Clojure" sequel.
I've added the speculative analysis required to detect when recur arguments fail to match the type of primitive loop locals, and recompile the loop with those loop args boxed. When *warn-on- reflection* is true it will issue a report that this is happening and why.
This code is in commit 0df995dc6d31a9f4d0fe199bc63c4abfac7c86b1 on the equal branch:
http://github.com/richhickey/clojure/commits/equal 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