On Sun, Jun 20, 2010 at 2:34 PM, Heinz N. Gies <he...@licenser.net> wrote:

>
> To 3)
> To the third thing and in my eyes this is the most challenging and
> problematic issue. loop in current clojure is not statically typing (of
> cause it is but it tosses objects in any field so you can pass whatever you
> want and it still works). The current qual branch introduces silent
> (implicit) static typing if you use primitives this in my eye can lead to a
> lot of confusion and requires the user to know a lot about clojures under
> the hood to safely use recur.



With what I think is 1.2-MASTER, a few weeks old (I start to be a bit lost
with many clojure.jar):

user=> (loop [i (long 1)] (recur :a))
#<CompilerException java.lang.RuntimeException:
java.lang.IllegalArgumentException: recur arg for primitive local: i must be
matching primitive (NO_SOURCE_FILE:2)>

There is static typing for primitive already. (And I think it has been like
that since a long time). It is what allows clojure to java-like fast on hot
loops.
The new problem, as far as I understand it, is that, if literals are
primitives, my snippset is equivalent to
 (loop [i 1] (recur :a))

It might be easier to have the same default for literals and return values
of operators (even if it is, as I would like, a parameterizable default).
Or to have a warning and a cast, for non primitive recur in a primitive
loop?
(Might help if the next iteration comes as a result of a non-static
function)

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