On Mar 16, 2009, at 8:25 PM, Laurent PETIT wrote:
Hi Laurent,
Your solution is indeed close to what I had in mind in terms of requirements. I was currently hacking with clojure java class Compiler to enhance Timothy's patch and add a variation on what you described.
Cool. I look forward to seeing what you come up with.
* does the Compiler.load() process happen all in the same thread ? (And if yes, is that a guaranteed feature, or could that change in the future ?)
Compiler.load() appears to execute in a single thread currently. I'm not aware of any guarantee about that. As a general rule, anything that's not documented by Rich is eligible to be changed in the future. In thinking about how that might work, it seems to me that making a single load multithreaded would be more complex than it would be worth, but no guarantees.
* How do you correctly deref, ref-set! from java code by directly using a Var instance ?
ref-set is an operation on refs. deref can be applied to refs. myRef.set(anObject); myRef.deref(); Or, using the fine clojure.contrib.repl-utils: user=> (source ref-set) (defn ref-set "Must be called in a transaction. Sets the value of ref. Returns val." [#^clojure.lang.Ref ref val] (. ref (set val))) nil user=> (source deref) (defn deref"Also reader macro: @ref/@agent/@var/@atom/@delay/@future. Within a transaction,
returns the in-transaction-value of ref, else returns the most-recently-committed value of ref. When applied to a var, agent or atom, returns its current state. When applied to a delay, forces it if not already forced. When applied to a future, will block if computation not complete" [#^clojure.lang.IDeref ref] (.deref ref)) nil user=> (show clojure.lang.Ref) === public clojure.lang.Ref === [ 0] <init> (Object) ... [10] deref : Object () ... [46] set : Object (Object) ... [53] wait : void (long,int) nil user=> (show clojure.lang.Ref 46)#<Method public java.lang.Object clojure.lang.Ref.set(java.lang.Object)>
user=> (show clojure.lang.Ref 10) #<Method public java.lang.Object clojure.lang.Ref.deref()> user=> --Steve
smime.p7s
Description: S/MIME cryptographic signature