> My problem was that I thought the literal "1" will be boxed behind the
> scenes, I didn't even bother looking for a version of "add" for
> primitives because I thought they never existed in Clojure.
>
> I'll try to go over the Numbers class again and see if all this makes
> sense.
Looks like the compiler is enforcing that loop arguments match the
primitive type of the local bindings; if they do, it'll emit code with
unboxed primitives.
if(lb.getPrimitiveType() != null)
{
Class primc = lb.getPrimitiveType();
try
{
if(!(arg instanceof MaybePrimitiveExpr && arg.hasJavaClass()
&& arg.getJavaClass() == primc))
throw new IllegalArgumentException("recur arg for
primitive local: " +
lb.name + " must be matching primitive");
}
catch(Exception e)
{
throw new RuntimeException(e);
}
((MaybePrimitiveExpr) arg).emitUnboxed(C.EXPRESSION, objx, gen);
}
else
{
arg.emit(C.EXPRESSION, objx, gen);
}
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en