On Thu, Dec 15, 2011 at 11:03 PM, Cedric Greevey <cgree...@gmail.com> wrote:
> For instance, if I want to optimize (distance x1 y1 z1 x2 y2 z2), I > can't. If I declare anything primitive, the compiler complains as > there are more than four arguments. If I change the input format to > (distance [x1 y1 z1] [x2 y2 z2]) the numbers are boxed as collection > elements, though at least I can now make the return be hinted as > ^double without the compiler complaining. Short of creating a Point3D > deftype with primitive components, there doesn't seem to be a way with > Clojure 1.3 to optimize this; and having to create lots of helper > types like Point3D smacks of Java-like coding instead of Clojure-like > coding to me. > I would not exactly call this: (deftype Point3d [^double x ^double y ^double z] IVecMath (distance [this other] ...)) "Java coding" :) I don't buy your example but I can certainly imagine desirable cases. > I *can't* see how to easily support collections-of-primitives without > a *lot* more work, including new syntax, in a *lot* of parts of the > language core, with a *lot* more likely damage to backward > compatibility. > Your solution also sounds like a *lot* of work for *someone*. > So there is my argument in a nutshell. There's an improvement we can > make *now*, *without* foreclosing on an improvement that *may* be > possible *in a few years or so*, and that would make mine, and > probably others', projects easier to optimize *now*, and which > therefore *should* be made, and quickly. What should and will happen is of course completely based on the level of contribution from interested parties, no? For me the discussion is exhausted. But you've spent time discussing it passionately, I recommend you send in your CA and write up these thoughts in a Clojure design document. 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