On Thu, Jun 17, 2010 at 11:00 PM, Rich Hickey <richhic...@gmail.com> wrote:

> In the end, this does put the interests of two sides of the community at
> odds. Only one set of interests can be the default. Part of the point of
> this discussion is to measure the sides (so speak up people!).


I am squarely on the side of prim/num/equals. The number of questions on the
ML, #clojure, StackOverflow, etc. for the past two years about proper
type-hinting shows how much incidental complexity the current system brings
to the table.

Look no further than:
http://clj-me.cgrand.net/2010/06/04/primitive-support-for-fns/
vs.
http://clj-me.cgrand.net/2010/06/10/primitive-types-support-for-fns-coming-to-a-clojure-branch-near-you/
.

The difference is startling.

In order to write decently fast numeric code in Clojure up until now you had
to be Christophe Grand ;) or have a fairly good understanding of macros that
walk code to tag primitive types. And even so, the inability to return
primitives made many nested recursive algorithms perform poorly. The only
way to work around this was to convert your functions to macros and inline
everything resulting of course in a considerable loss of modularity. Dirty
hacks.

For those that need BigInts (the majority of whom are solving Project Euler
problems, god bless them), telling them to add a single N is so much simpler
than explaining the current complexities to newcomers who don't understand
why floating point arithmetic is so darn slow.

More importantly, I think that
deftype/defrecord/protocols/static/prim/num/equals represent an astounding
work of *unification*. You no longer need to resort to Java - all the tools
for building fast code is right there.

My gut feeling is that many Clojure devs won't think to much about this work
- they've got their hands full with the rest of the language or are working
in domains where they are under the impression that this unification work
does not affect them. But I think this kind of work is paving the way for
the community to give more of a helping hand to converting core data
structures from Java to Clojure, extending them, patching them, and
contributing new ones - all in a language that (unlike Java) naturally
guides you to "do the right thing".

So though I don't know how much of a stir this thread will create (because I
think it's more of a large under the surface wave), I have no doubt it will
pay off in a big, big way.

-- 
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

Reply via email to