<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thanks Clement!<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Am 06.01.2018 um 14:44 schrieb Clément Bera <<a href="mailto:bera.clement@gmail.com" class="">bera.clement@gmail.com</a>>:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Sat, Jan 6, 2018 at 1:32 PM, Norbert Hartl<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:norbert@hartl.name" target="_blank" class="">norbert@hartl.name</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"> <br class=""><div style="word-wrap: break-word;" class="">Btw. why is the name NoModificationError? Isn’t the purpose of an Error that it is not resumable? And is NoModificationError very likely to be resumed? Like in #retryModification?</div></blockquote><div class=""><br class=""></div><div class="">Normally the NoModificationError should be able to retry the modification, and then resumes execution just after the primitive call / the inst var store. </div><div class=""><br class=""></div></div></div></blockquote>I was actually asking why the mentioned NoModificationError is an error and not a NoModificationException. </div><div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">In the case of primitive failure I guess either the error should resume with the value to return or the primitive fall-back code should return the correct value. In the case of inst var store, we need to resume execution using #jump (See #attemptToAssign: value withIndex: index)</div><div class=""> </div><div class="">For at:put: we could have:</div><div class=""><br class=""></div><div class=""><div style="font-size: 12.8px;" class=""><span class="gmail-m_1237586985416883183Apple-tab-span" style="white-space: pre-wrap;">     </span><primitive: 174 error: ec></div><div style="font-size: 12.8px;" class=""><span class="gmail-m_1237586985416883183Apple-tab-span" style="white-space: pre-wrap;">   </span>self isReadOnlyObject </div><div style="font-size: 12.8px;" class=""><span class="gmail-m_1237586985416883183Apple-tab-span" style="white-space: pre-wrap;">                </span>ifTrue: [<b class="">^<span class="Apple-converted-space"> </span></b>(ModificationForbidden for: self atInstVar: index with: anObject) signal]</div><div style="font-size: 12.8px;" class=""><span class="gmail-m_1237586985416883183Apple-tab-span" style="white-space: pre-wrap;">           </span>ifFalse: [ self primitiveFailed ]</div></div><div style="font-size: 12.8px;" class=""><br class=""></div><div style="font-size: 12.8px;" class="">OR </div><div class=""><br class=""></div><div class=""><div style="font-size: 12.8px;" class=""><span class="gmail-m_1237586985416883183Apple-tab-span" style="white-space: pre-wrap;">      </span><primitive: 174 error: ec></div><div style="font-size: 12.8px;" class=""><span class="gmail-m_1237586985416883183Apple-tab-span" style="white-space: pre-wrap;">   </span>self isReadOnlyObject </div><div style="font-size: 12.8px;" class=""><span class="gmail-m_1237586985416883183Apple-tab-span" style="white-space: pre-wrap;">                </span>ifTrue: [(ModificationForbidden for: self atInstVar: index with: anObject) signal.<span class="Apple-converted-space"> </span><b class="">^ anObject</b>]</div><div style="font-size: 12.8px;" class=""><span class="gmail-m_1237586985416883183Apple-tab-span" style="white-space: pre-wrap;">         </span>ifFalse: [ self primitiveFailed ]</div></div><div style="font-size: 12.8px;" class=""><br class=""></div><div style="font-size: 12.8px;" class="">+ the index bound check mentioned by Eliot and asInteger trick (based on at: primitive failure code)</div><div style="font-size: 12.8px;" class=""><br class=""></div><div style="font-size: 12.8px;" class="">So that when the exception resumes the correct behavior happens.</div><div class=""><br class=""></div></div></div></blockquote>I have now</div><div><br class=""></div><div><div>at: index put: value </div><div><span class="Apple-tab-span" style="white-space:pre">      </span>"Primitive. Assumes receiver is indexable. Store the argument value in </div><div><span class="Apple-tab-span" style="white-space:pre">    </span>the indexable element of the receiver indicated by index. Fail if the </div><div><span class="Apple-tab-span" style="white-space:pre">  </span>index is not an Integer or is out of bounds. Or fail if the value is not of </div><div><span class="Apple-tab-span" style="white-space:pre">    </span>the right type for this kind of collection. Answer the value that was </div><div><span class="Apple-tab-span" style="white-space:pre">  </span>stored. Essential. See Object documentation whatIsAPrimitive."</div><div><br class=""></div><div><span class="Apple-tab-span" style="white-space:pre">      </span><primitive: 61></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>index isInteger </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>ifTrue: [self class isVariable</div><div><span class="Apple-tab-span" style="white-space:pre">                       </span>ifTrue: [(index between: 1 and: self size)</div><div><span class="Apple-tab-span" style="white-space:pre">                           </span>ifFalse: [self errorSubscriptBounds: index]]</div><div><span class="Apple-tab-span" style="white-space:pre">                 </span>ifFalse: [self errorNotIndexable]]</div><div><span class="Apple-tab-span" style="white-space:pre">           </span>ifFalse: [  </div><div><span class="Apple-tab-span" style="white-space:pre">                    </span>index isNumber</div><div><span class="Apple-tab-span" style="white-space:pre">                               </span>ifTrue: [^self at: index asInteger put: value]</div><div><span class="Apple-tab-span" style="white-space:pre">                               </span>ifFalse: [self errorNonIntegerIndex] ].</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>self isReadOnlyObject </div><div><span class="Apple-tab-span" style="white-space:pre">          </span>ifTrue: [ ^ (InstVarModificationForbidden for: self atInstVar: index with: value) signal ].</div><div><br class=""></div><div>Norbert</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><br class=""></div><div class="">Norbert<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">Am 05.01.2018 um 14:34 schrieb Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank" class="">eliot.miranda@gmail.com</a>>:</div><br class="gmail-m_-4419134607335559338Apple-interchange-newline"><div class=""><div dir="auto" class=""><div class="">Hi Clément,</div><div class=""><br class=""></div><div class="">   <span class="Apple-converted-space"> </span>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.<br class=""><br class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">_,,,^..^,,,_ (phone)</span></div><div class=""><br class="">On Jan 5, 2018, at 5:22 AM, Clément Bera <<a href="mailto:bera.clement@gmail.com" target="_blank" class="">bera.clement@gmail.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><span class=""></span></div></blockquote><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Hi,</div><div class=""><br class=""></div><div class="">No this is not a bug.</div><div class=""><br class=""></div>This needs to be handled in the primitive failure code in the image, the method should be something like that :<div class=""><br class=""><div class=""><div class=""><font face="monospace, monospace" class="">Object>>instVarAt: index put: anObject</font></div><div class=""><font face="monospace, monospace" class=""><span style="white-space: pre-wrap;" class="">  </span><primitive: 174 error: ec></font></div><div class=""><font face="monospace, monospace" class="">       <span class="Apple-converted-space"> </span>self isReadOnlyObject ifTrue: [(ModificationForbidden for: self atInstVar: index with: anObject) signal]</font></div><div class=""><font face="monospace, monospace" class=""><span style="white-space: pre-wrap;" class=""> </span>self primitiveFailed</font></div><div class=""><br class=""></div><div class="">All primitive fall-back code triggering object mutation should be rewritten this way, especially primitives such as #at:put:, #instVarAt:put:, etc.</div><div class=""><br class=""></div></div></div><div class="">Cheers</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Jan 5, 2018 at 1:42 PM, Norbert Hartl<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:norbert@hartl.name" target="_blank" class="">norbert@hartl.name</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"> <br class=""><div style="word-wrap: break-word;" class="">If I do <div class=""><br class=""></div><div class=""><div class="">(#foo -> #bar)</div><div class=""><span class="gmail-m_-4419134607335559338m_-2406158539713268726Apple-tab-span" style="white-space: pre-wrap;">       </span>beReadOnlyObject;</div><div class=""><span class="gmail-m_-4419134607335559338m_-2406158539713268726Apple-tab-span" style="white-space: pre-wrap;">        </span>value: #baz</div></div><div class=""><br class=""></div><div class="">it throws</div><div class=""><br class=""></div><div class=""><b class="">ModificationForbidden:  #foo->#bar is read-only, hence its field 2 cannot be modified with #baz</b></div><div class=""><br class=""></div><div class=""> which is as expected. But if I do</div><div class=""><br class=""></div><div class=""><div class="">(#foo -> #bar)</div><div class=""><span class="gmail-m_-4419134607335559338m_-2406158539713268726Apple-tab-span" style="white-space: pre-wrap;">  </span>beReadOnlyObject;</div><div class=""><span class="gmail-m_-4419134607335559338m_-2406158539713268726Apple-tab-span" style="white-space: pre-wrap;">        </span>instVarNamed: #value put: #baz</div></div><div class=""><br class=""></div><div class="">I get</div><div class=""><br class=""></div><div class=""><b class="">PrimitiveFailed: primitive #instVarAt:put: in Association failed</b></div><div class=""><br class=""></div><div class="">I think this a bug, no?</div><div class=""><br class=""></div><div class="">Norbert</div></div><br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail-m_-4419134607335559338gmail_signature"><div dir="ltr" class=""><span style="font-size: 12.8px;" class="">Clément Béra</span><div style="font-size: 12.8px;" class="">Pharo consortium engineer</div><div style="font-size: 12.8px;" class=""><a href="https://clementbera.wordpress.com/" target="_blank" class="">https://clementbera.wordpress.<wbr class="">com/</a><br class=""></div><div style="font-size: 12.8px;" class=""><span style="line-height: 16px;" class="">Bâtiment B 40, avenue Halley 59650 </span><span style="font-weight: bold; line-height: 16px;" class="">Villeneuve d'Ascq</span></div></div></div></div></div></blockquote></div></div></blockquote></div><br class=""></div></div><br class=""></blockquote></div><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br clear="all" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">--<span class="Apple-converted-space"> </span></span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_signature" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr" class=""><span style="font-size: 12.8px;" class="">Clément Béra</span><div style="font-size: 12.8px;" class="">Pharo consortium engineer</div><div style="font-size: 12.8px;" class=""><a href="https://clementbera.wordpress.com/" target="_blank" class="">https://clementbera.wordpress.com/</a><br class=""></div><div style="font-size: 12.8px;" class=""><span style="line-height: 16px;" class="">Bâtiment B 40, avenue Halley 59650 </span><span style="font-weight: bold; line-height: 16px;" class="">Villeneuve d'Ascq</span></div></div></div></div></blockquote></div><br class=""></body></html>