Re: Clojure 1.3 wonky behavior

2011-10-25 Thread Micah Martin
Right Rich, Thanks. But that was a simplified reduction of real usage. Typically the declare is found in a nested structure: (describe something (context fooey (with bar 42) ; declare comes from this macro (it works (should= 42

Re: Clojure 1.3 wonky behavior

2011-10-25 Thread Laurent PETIT
2011/10/25 Micah Martin micahmar...@gmail.com: Right Rich, Thanks.  But that was a simplified reduction of real usage.   Typically the declare is found in a nested structure: (describe something        (context fooey                (with bar 42)  ; declare comes from this macro              

Re: Clojure 1.3 wonky behavior

2011-10-24 Thread Micah Martin
Thanks for the explanation All. I have a much better grasp of what's going on now. Just one more question: It is defined behavior, or should I submit a patch for Clojure 1.3? Micah On Oct 20, 2011, at 7:55 PM, Chouser wrote: On Thu, Oct 20, 2011 at 4:31 PM, Chris Perkins

Re: Clojure 1.3 wonky behavior

2011-10-24 Thread Rich Hickey
You should use 'do' for that kind of thing, not list. Rich On Oct 20, 2011, at 1:53 PM, Micah Martin wrote: I recently tried to get Speclj running on Clojure 1.3 and came across the following problem: (list (declare ^:dynamic p) (defn q [] @p)) (binding [p (atom 10)] (q))

Clojure 1.3 wonky behavior

2011-10-20 Thread Micah Martin
I recently tried to get Speclj running on Clojure 1.3 and came across the following problem: (list (declare ^:dynamic p) (defn q [] @p)) (binding [p (atom 10)] (q)) java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.IDeref Thanks to @cemerick for

Re: Clojure 1.3 wonky behavior

2011-10-20 Thread Meikel Brandmeyer
Hi, Am 20.10.2011 um 19:53 schrieb Micah Martin: I recently tried to get Speclj running on Clojure 1.3 and came across the following problem: (list (declare ^:dynamic p) (defn q [] @p)) (binding [p (atom 10)] (q)) java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be

Re: Clojure 1.3 wonky behavior

2011-10-20 Thread Chris Perkins
To put it another way: a top-level do is special-cased to compile and then immediately execute each contained form, in order. Any other top-level form, such as list, will be fully compiled, including all contained forms, and only then executed. In this case, the defn cannot compile because the

Re: Clojure 1.3 wonky behavior

2011-10-20 Thread Chris Perkins
Note: I forgot to preface that with I think... :) Upon experimenting briefly, it turns out I was wrong about how Clojure works (that seems to happen a lot with me). A declare/def defines a var even when it's not executed! user (defn xxx [] (declare yyy)) #'user/xxx user yyy #Unbound Unbound:

Re: Clojure 1.3 wonky behavior

2011-10-20 Thread Chouser
On Thu, Oct 20, 2011 at 4:31 PM, Chris Perkins chrisperkin...@gmail.com wrote: Note: I forgot to preface that with I think... :)  Upon experimenting briefly, it turns out I was wrong about how Clojure works (that seems to happen a lot with me).  A declare/def defines a var even when it's not