On May 11, 2011, at 1:20 PM, Armando Blancas wrote:

> Have you seen this?
> http://www.assembla.com/wiki/show/clojure/Enhanced_Primitive_Support
> 

Indeed, though that's old.  See 
http://dev.clojure.org/display/doc/Enhanced+Primitive+Support instead.

> I couldn't find a practical use of doing (defn ^String foo [] ...)
> what's hinting the fn name good for?

That's how one hints a non-primitive return type; that's been the case for a 
long time now.


> You don't mention ^:static and that seems to be required for best
> performance.
> :static
> •defn supports {:static true} metadata
> •:static fns can take/return longs and doubles in addition to Objects
> •compiler will compile static methods in addition to IFn virtual
> methods

^:static has been a no-op for a while AFAIK, made unnecessary after changes to 
vars a while back.

> The metadata isn't there, so I guess some symbol table is involved in
> compiling static functions, not just the var.

The compiler relies upon a stack of interfaces that define primitive-hinted 
function invocation:

https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java#L91

I haven't investigated the details sufficiently enough to comment beyond that.

- Chas

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