On Fri 14/01/11 17:07 , Sam Aaron samaa...@gmail.com sent:
> Today I evaluated John Lawrence Aspden's Clojure port of a fractal tree
> program which contains optimisations targeting 1.3:
> http://www.learningclojure.com/2010/09/clojure-13-first-impress
> ion.html
> Unfortunately, this no longer compiles with 1.3.0-alpha4 as draw-tree has
> too many arguments:
> "CompilerException java.lang.IllegalArgumentException: fns taking
> primitives support only 4 or fewer args"
> The signature of the offending function is as follows:
> 
> (defn ^:static draw-tree [ #^Graphics g2d ^double angle ^double x ^double y
> ^double length ^double branch-angle ^long depth] ...)

Note that from what I understand, ^:static doesn't do anything any more.  
(Despite it appearing in core.clj in a few places).

In early snapshots of 1.3, primitive arguments were implemented by ^:static, 
which caused the function implementation class 
to get augmented with a static method with primitive arguments.  There were a 
number of limitations of this approach - for 
instance it only supported top-level functions, not closures; and I think it 
lacked some of the dynamic features of normal 
features.

The new implementation of primitive functions doesn't require the ^:static tag, 
but it does limit the function to a maximum 
of 4 args.

As David Nolen suggests, deftypes/defrecords support primitive fields, so 
wrapping the arguments in this way is probably the 
easiest option.

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