That's great - now why didn't I realise that :-)

Thanks,

Chris




2009/11/24 Christophe Grand <[email protected]>

> Hi,
>
>
> On Tue, Nov 24, 2009 at 6:38 PM, Chris Jenkins <[email protected]>wrote:
>
>> Is it possible to set *warn-on-reflection* such that it can be seen by
>> multiple threads? I can't use def to define *warn-on-reflection* because it
>> is defined in another namespace. I can use set! to change the value of the
>> binding for one thread but this is not seen by other threads:
>>
>> (set! *warn-on-reflection* true)
>> (.start (Thread. #(println *warn-on-reflection*)))
>>
>> ...prints false
>>
>> The reason that I would like to do this is that I'm writing a program that
>> uses Swing and I'd like to see if reflection is used on callbacks that
>> execute on the AWT event thread... ideally without having to figure out how
>> to make Swing call my function that sets *warn-on-reflection* before it does
>> anything else.
>>
>
> *warn-on-reflection* is a compile-time flag, not a runtime flag so, unless
> you are using eval in the event thread, you don't need to care. Clojure
> outputs the warnings once: when you define the function.
>
> hth,
>
> Christophe
>
> --
> Professional: http://cgrand.net/ (fr)
> On Clojure: http://clj-me.cgrand.net/ (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]<clojure%[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

Reply via email to