On Oct 11, 2014, at 10:59 AM, Jony Hudson <jonyepsi...@gmail.com> wrote:

> But if any of these Keyword objects were garbage-collected, I think it would 
> break the parity between identical? and =. 

The Keyword construction and interning mechanism ensures that whenever there 
exists at least once (strong) reference to a given Keyword object, all 
references will be to the same object.

A given Keyword object can only be garbage collected if it's garbage--if there 
are no (strong) references to it currently in existence. That means it's not a 
key or value in any map, it's not in use by any compiled code, it's not the 
value of any local, etc. Without any existing strong reference to it, no 
comparison involving that Keyword object is possible.

If at any point in time there are no strong references to it, it's safe to 
un-intern the Keyword object. If a keyword of that name (and namespace) is 
needed subsequently, a new Keyword object can be created and interned and the 
promised identity and equality semantics will be satisfied from that point 
forward.

--Steve

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to