Am 05.01.2018 um 16:53 schrieb Clément Bera <bera.clement@gmail.com>:On Fri, Jan 5, 2018 at 4:05 PM, Norbert Hartl <norbert@hartl.name> wrote: You mean<primitive: 174 error: ec>self isReadOnlyObjectifTrue: [(ModificationForbidden for: self atInstVar: index with: anObject) signal]ifFalse: [ self primitiveFailed ]?Norbertyes something like that.Same thing for Object>>#at:put:, floatAt:put: and so on.I’m working on it and came byObject>>#primitiveChangeClassTo: and I wonder what would be the approach here. The ModificationForbidden/NoModificationError seems to be tight to an index. What would be the case for a class change? Another Exception class?
ModificationForbiddenStateModificationForbiddenClassModificationForbidden
How is that solved in VW?NorbertAm 05.01.2018 um 14:22 schrieb Clément Bera <bera.clement@gmail.com>:Hi,No this is not a bug.This needs to be handled in the primitive failure code in the image, the method should be something like that :Object>>instVarAt: index put: anObject<primitive: 174 error: ec>self isReadOnlyObject ifTrue: [(ModificationForbidden for: self atInstVar: index with: anObject) signal]self primitiveFailedAll primitive fall-back code triggering object mutation should be rewritten this way, especially primitives such as #at:put:, #instVarAt:put:, etc.CheersOn Fri, Jan 5, 2018 at 1:42 PM, Norbert Hartl <norbert@hartl.name> wrote: If I do(#foo -> #bar)beReadOnlyObject;value: #bazit throwsModificationForbidden: #foo->#bar is read-only, hence its field 2 cannot be modified with #bazwhich is as expected. But if I do(#foo -> #bar)beReadOnlyObject;instVarNamed: #value put: #bazI getPrimitiveFailed: primitive #instVarAt:put: in Association failedI think this a bug, no?Norbert--Clément BéraPharo consortium engineerBâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq--Clément BéraPharo consortium engineerBâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq