Thanks!

I initially saw that the count field of ArrayNode (in PersistentHashMap) is 
non-final and also mutated in at least one case, and began to question 
things.

But, for that particular example, if that field is only mutated in the case 
of editing transients, then for the non-transient case ArrayNode is 
effectively immutable but also safely published by any truly immutable data 
structures by being referred to in final fields.

Excellent! I had to look for myself, and now I feel much more comfortable 
that Clojure is built upon the bedrock it needs to be :)

On Tuesday, May 6, 2014 7:49:07 PM UTC-4, Alex Miller wrote:
>
> The Clojure persistent data structures are truly immutable - all fields 
> are final and referred objects are not mutated after construction so that 
> freeze occurs.  One obvious exception are the transient variants (
> http://clojure.org/transients). You can look at the code in 
> https://github.com/clojure/clojure/tree/master/src/jvm/clojure/lang - any 
> of the Persistent*.java.
>
> On Tuesday, May 6, 2014 4:11:49 PM UTC-5, Mike Fikes wrote:
>>
>> Are the persistent immutable data structures in Clojure "truly" immutable 
>> (using final fields, relying on constructor freezing), or are they mean to 
>> be merely effectively immutable (as defined in JICP)?
>>
>

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