Primitives can only be stored inside a local (i.e., a let binding). Primitives are auto-boxed everywhere else. A type hint implies an object (not a primitive). See this post for more info.
http://groups.google.com/group/clojure/msg/1e0d52ae931c730d Travis On Aug 12, 5:54 am, Tayssir John Gabbour <tayssir.j...@googlemail.com> wrote: > On this topic, how do primitives work? I heard something about > "function boundaries." Which I interpret to mean that when a function > returns a primitive, Clojure boxes it in some Java object. And type > declarations can't stop this boxing from happening. > > Is this a correct understanding? (I doubt it is, since it leads to odd > conclusions.) And what is the performance penalty here? > > (I'm not personally concerned about performance, just curious.) > > Thanks, > Tayssir > > On Aug 11, 8:55 pm, fft1976 <fft1...@gmail.com> wrote: > > > I feel that this question is important enough to warrant its own > > thread. > > > If you use Java's arrays and declare all types, should Clojure be as > > fast as the equivalent Java? I had taken this for granted, but > > empirical evidence indicates otherwise: > > > Andy's version of the Nbody benchmark still appears to be about 10x > > slower than Java: > > > Clojure:http://github.com/jafingerhut/clojure-benchmarks/blob/9dc56d8ff53f0b8... > > > Java (runs 21 > > times):http://shootout.alioth.debian.org/u32/benchmark.php?test=nbody〈=j... > > > Why?! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---