user.clj is loaded before thread-local bindings are established. I see you're using Repl.java. You can see the call to pushThreadBindings there to see how it works. user.clj allows you to set up the user namespace, but not set! most vars.

With the repl in clojure.main, you can include an init file on your "java..." command line using the "-i" option. It will be loaded after those bindings have been established. We do not have anything like a "repl-init.clj" file that's auto-loaded if it exists to accomplish these kinds of settings. It might be a good idea to have one, loaded from classpath, with a suitable name.

More complete solutions to this initialization task (.e.g., for the bash shell) look in a few places for init files. That's something to consider as well.

--Steve

On Dec 9, 2008, at 3:12 PM, Stuart Halloway wrote:


Why can't I call set! in user.clj? (And what is the idiomatic way to
do what I want here?)

(set! *print-length* 103)
-> Exception in thread "main" java.lang.ExceptionInInitializerError
        at clojure.lang.Repl.<clinit>(Repl.java:23)
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException:
Can't change/establish root binding of: *print-length* with set

Thanks,
Stuart





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


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to