[Pharo-dev] Can someone explain me what this code doing?
siguctua at gmail.com
Mon Aug 26 16:47:27 EDT 2013
| oldValue |
lock ifTrue: [ ^ self ].
lock := true.
oldValue := contents.
contents := anObject.
[ self contentsChanged: oldValue ] ensure: [ lock := false ].
it is really interesting.. it appears you cannot change the contents
of value holder (as you can see it will simply ignore it) when it
'locked' during announcing the change event.
i know, this will prevent it from entering recursive loop,
but i would instead throw an error in such case(s)
because code which modifying the value as a reaction on value change
is something really stupid and must be fixed, instead
of putting workaround which will block the value holder from
accepting new value(s).. and that is really bad:
- notification(s) about some property change should not
block the value from being able to be changed
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Pharo-dev