On 19 June 2010 03:33, Rich Hickey <richhic...@gmail.com> wrote: > Turnabout is fair play, so I've produced a version that swaps the > defaults, still in the 'equal' branch:
The issue of which behaviour should be the default aside, I think that I'd expect the *, + etc. ops to go with unannotated literals and the primed variants to go with explicit hinting, whereas now this seems not to be the case: (defn fact [n] (loop [n (num n) r (num 1)] (if (zero? n) r (recur (dec n) (* r n))))) This works for (fact 40), whereas the version with dec' and *' (and the (num ...) still in place) doesn't; I'd expect this to be reversed. In general, I'd expect the primed ops to be there for those who know what they're doing; same goes for explicit hinting. On 19 June 2010 04:12, Rich Hickey <richhic...@gmail.com> wrote: > I have to say I'm in the 'pay for what you use' camp - you need a box, you > ask for one. If I don't (and neither do any of those loops), why should I > have to do extra work to avoid it? The question is which desirable commodity Clojure programmers can expect to get for free and which is to be obtainable through voluntary banter: the sturdy boxes or the Potion of Speed +5. I'm used to paying for the PoS, but a sudden rise in the price of boxes seems unwarranted to me, especially if it only serves to lower the price of the PoS from a (prim ...) hint where the local is introduced to zero. I mean, this is no longer about "the free lunch", it's more about "the free dessert" which the power number crunchers surely do not need. I have a hunch that if (num ...) stays in and primitive is the default, people (I mean just about *everybody*) will only box things in the face of the first crash or *maybe* after developing a great intuitive feel for when that might be required. Of course there's going to be a period of frantic learning about numeric representations on the JVM etc. in between the crash and the boxing. And, um, whatever for...? Interestingly, the introductory materials on Clojure I've read so far tout the "don't worry about it" quality of Clojure's numerics as a benefit of the language. (The "don't worry about it" phrasing comes from "Programming Clojure".) I just mention this because I tend to think it reasonable to present that as a benefit. The idea of making a U-turn on this is surprising to me... Which is partly to say that I'm still evaluating it, though so far my intuition stays pretty firmly on the "don't worry about it"-is-good side. TLDR summary: I'm very excited about the latest equal; I'd definitely want the primed arithmetic ops to go with the hinted locals, whereas non-primed (basic) variants would do the right thing for the simplest, unhinted code (so which ops should get the primes in my eyes depends on whether boxing of locals is the default); my heart is still on the side of free sturdy boxes while I'm expecting to pay for the Potion of Speed. Sincerely, Michał -- 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