2014-05-14 12:50 GMT+02:00 Igor Stasenko <siguc...@gmail.com>:

>
> 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 :)
>
>
>
>
+1
Even a veryDeepCopy (sic...) would not be enough for safety.
We are dynamic and the behavior can change at any moment.
So you'd need to also duplicate the whole class hierarchy of each and every
object in the graph.

Or lock if you prefer lock to copy, but problem remains the same...



> --
> Best regards,
> Igor Stasenko.
>

Reply via email to