I came across the following behavior today, and wanted to make sure
it's expected (on 1.2 and 1.3-beta2).
Each time a reify form is executed, two fresh objects seem to be
created; one is immediately thrown away, and the other is returned
from the form:

user=> (defn foo [] (let [x (reify Object (finalize [this] (println
"Finalize" this)))] (println "Create" x) x))
user=> (def x [(foo) (foo)])
Create #<user$foo$reify__86 user$foo$reify__86@74002515>
Create #<user$foo$reify__86 user$foo$reify__86@3582c132>

user=> (System/gc)
Finalize #<user$foo$reify__86 user$foo$reify__86@318efaea>
Finalize #<user$foo$reify__86 user$foo$reify__86@72940b84>

user=> (def x nil)
user=> (System/gc)
Finalize #<user$foo$reify__86 user$foo$reify__86@3582c132>
Finalize #<user$foo$reify__86 user$foo$reify__86@74002515>

Thanks,
Jason

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to