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 @bar)))) ; here bar be unbound
I'll see if I can restructure Speclj to get all the Vars declared at the root
level. But I'd still like to know….
Is this defined behavior? Or am I jumping through hoops to avoid behavior that
doesn't belong?
Micah
On Oct 24, 2011, at 7:23 PM, Rich Hickey wrote:
> 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))
>>
>>> java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to
>>> clojure.lang.IDeref
>>
>> Thanks to @cemerick for helping me condense the snippet, and thanks to both
>> @cemerick and @chouser for the lively discussion on IRC. Yet the discussion
>> was inconclusive. Is the above expected behavior?
>>
>> Micah
>>
>> --
>> 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
>
> --
> 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
--
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