Ken Wesson wrote:

> The interfaces are needed only if the function is passed around as an
> object or dynamically rebound; if it's just called at a few fixed
> sites, those calls can be directly to a known class.

The class names of function implementations seem to be a Clojure
implementation detail. It has changed over the years, classes used to
contain a unique numeric suffix. Closures don't have obvious names. If
a function gets wrapped in something like a primitive-aware memoize,
the client call sites shouldn't need to be recompiled.

So I don't think a direct call to the implementation class is enough.

> Even then, couldn't the compiler generate the needed interfaces for a
> specific Clojure project on the fly along with the appropriate calls?

I don't see why it couldn't. Actually I just hacked the Clojure
compiler to do that, removed the limitation on 4 args, and removed all
of the static IFn$*** classes, and it seemed to work fine.

The static IFn$*** classes probably have some small value though. For
instance, if some Java code is passed a dynamically created fn, which
it knows to have a primitive interface, it can cast it to one of these
pre-defined interfaces, whereas if the interfaces were only created
dynamically, it wouldn't be easy to get the Java to compile in that
case.

1.3 is currently an alpha, I suspect that this first stab at primitive
args is currently deliberately conservative.

-- 
Dave

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