On Mon, 2009-06-29 at 07:04 -0700, arasoft wrote:
> I very much like your idea of setting *math-context* (I was looking
> for something like that, but could not find it in the documentation),
> but how do I do it globally?
>
> user=> (set! *math-context* java.math.MathContext/DECIMAL128)
> #<CompilerException java.lang.IllegalStateException: Can't change/
> establish root binding of: *math-context* with set (NO_SOURCE_FILE:0)>
>
> whereas
>
> (set! *warn-on-reflection* true)
>
> works fine?
>
> What is the difference? How is it done right?
I am not sure, but I believe it's due to *warn-on-reflection* being
bound by the compiler/REPL before evaluating (set! *warn-on-reflection*
true).
When I looked, the REPL was called within a macro 'with-bindings repl'
that expands to
(binding [....
*warn-on-reflection* ....
]
repl)
allowing the execution of REPL to set! *war-on-reflection* and some
other similar vars. (*ns*, *compile-files*, *compile-path*, etc...)
I suppose the compiler does a similar thing, but I have never looked.
Best,
Nicolas.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---