On Thu, Sep 15, 2011 at 3:18 AM, Sergey Didenko <sergey.dide...@gmail.com>wrote:

> Hi,
>
> Is it a bug or I'm doing something wrong? I can't get rid of
> auto-boxing in the second example, neither by type hinting nor by type
> coercing of "changed*" locals.
>
> (set! *warn-on-reflection* true)
>
> This compiles fine:
>
> (loop [x 1 changed 0]
>  (if (= x 10)
>    changed
>    (recur (inc x)
>           changed)))
>
> And this gives the warning "recur arg for primitive local: changed is
> not matching primitive, had: Object, needed: long
> Auto-boxing loop arg: change"
>
> (loop [x 1 changed 0]
>  (if (= x 10)
>    changed
>    (recur (inc x)
>           (loop [y 1 changed-y changed]
>             changed-y))))
>
> P.S. I omitted recur for the inner loop for clarity.
>

Loop itself will return boxed values I think.

David

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