But how well "unmodifiable" collection is?
Should it protect also from modifying the items themselves? Or any
object(s) accessible through items? Or any objects accessible through all
objects accessible through items?
Because without propagating immutability how you cannot prove that you
actually made things "safe"?
There was a work by Jean-Baptiste exploring that direction, by introducing
special kind of references (immutable references).. which is a special view
on object that does not allows its modification and also has an option to
propagate same kind of property on all references it may give away.
This is done at VM level, sure thing.. and sure thing there is a
performance cost..
but again, if you so desperately need "safety", just making immutable
collections is not a solution. It is much more involved :)



-- 
Best regards,
Igor Stasenko.

Reply via email to