Hi Clément,
is it too late to take a look at the VisualWorks code and use the same class names and selectors they use? IIRC it is NoMidificationError. It may make e.g. Gemstone's job easier if there is some consistency.
_,,,^..^,,,_ (phone)
On Jan 5, 2018, at 5:22 AM, Clément Bera bera.clement@gmail.com wrote:
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 primitiveFailed
All primitive fall-back code triggering object mutation should be rewritten this way, especially primitives such as #at:put:, #instVarAt:put:, etc.
Cheers
On Fri, Jan 5, 2018 at 1:42 PM, Norbert Hartl norbert@hartl.name wrote:
If I do
(#foo -> #bar) beReadOnlyObject; value: #baz
it throws
ModificationForbidden: #foo->#bar is read-only, hence its field 2 cannot be modified with #baz
which is as expected. But if I do
(#foo -> #bar) beReadOnlyObject; instVarNamed: #value put: #baz
I get
PrimitiveFailed: primitive #instVarAt:put: in Association failed
I think this a bug, no?
Norbert
-- Clément Béra Pharo consortium engineer https://clementbera.wordpress.com/ Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq