[Vm-dev] Bug in #instVarAt:put: for read-only objects
Denis Kudriashov
dionisiydk at gmail.com
Wed Jan 10 12:43:59 UTC 2018
2018-01-10 11:15 GMT+01:00 Denis Kudriashov <dionisiydk at gmail.com>:
> So I would introduce little hierarchy which I already mentioned:
>
> ModificationForbidden
> FieldModificationForbidden
> ClassModificationForbidden
> BecomeModificationForbidden
>
> On the base class there will be object, newValue, retrySelector and
> isMirror flag. And fieldIndex will be moved to the
> FieldModificationForbidden.
> Mirror flag is required to correctly retry mirror based modification
> because first argument in that case is always "actual receiver" instead of
> index.
>
I was not correct about mirrors case. It can be handled without flag. For
example:
Context class >> object: anObject basicAt: index put: aValue
"......"
anObject isReadOnlyObject
ifTrue: [ ^ (ModificationForbidden new
object: anObject;
fieldIndex: index;
newValue: value;
retrySelector: #basicAt:put:) signal ].
But this simplification can break some scenarios because users of mirrors
do not want direct interaction with given object. But retry operation will
force it with direct message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180110/027ba5cd/attachment.html>
More information about the Vm-dev
mailing list