David T. Lewis uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-dtl.1343.mcz ==================== Summary ==================== Name: Kernel-dtl.1343 Author: dtl Time: 2 October 2020, 10:26:27.397227 pm UUID: 1fcc87a9-8b18-4a84-b240-4dd9f24cfa46 Ancestors: Kernel-eem.1342, Kernel-ct.1321 Merge Kernel-ct.1321 per http://lists.squeakfoundation.org/pipermail/squeak-dev/2020-October/211967.html =============== Diff against Kernel-eem.1342 =============== Item was changed: + Error subclass: #ModificationForbidden - Exception subclass: #ModificationForbidden instanceVariableNames: 'mirror object fieldIndex newValue retrySelector resumptionValue' classVariableNames: '' poolDictionaries: '' category: 'Kernel-Exceptions'! + !ModificationForbidden commentStamp: 'ct 4/9/2020 19:49' prior: 0! + This error is raised when attempting to mutate a read-only object. - !ModificationForbidden commentStamp: 'eem 3/11/2020 15:46' prior: 0! - This exception is raised when attempting to mutate a read-only object. + My instances describe the necessary state to be able to reproduce the modification via the #retryModification protocol. - My instances have 5 fields to be able to reproduce the modification via the retryModification method. + Instance Variables + mirror: <Context | Behavior | Array> + object: <Object> + fieldIndex: <SmallInteger | nil> + newValue: <Object> + resumptionValue: <Object> + retrySelector: <Symbol> + + mirror + - the object that will perform the modification on object if modificationRetried + + object + - read-only object that attempted to mutate + + fieldIndex + - index of the field in the object mutated, relevant for the corresponding selector + + newValue + - value that was attempted to be stored into the read-only object + + resumptionValue + - value that will be returned when the ModificationForbidden is resumed + + retrySelector + - selector that can be used to reproduce the mutation (#object:basicAt:put:, #object:instVarAt:put:, etc.)! - mirror <Context|Behavior|Array> the object that will perform the modification on object if modificationRetried - object <Object> read-only object that attempted to mutate - index <SmallInteger | nil> index of the field in the object mutated, relevant for the corresponding selector - value <Object> value that was attempted to be stored into the read-only object - selector <Symbol> selector that can be used to reproduce the mutation (#object:basicAt:put:, #object:instVarAt:put:, etc)! Item was removed: - ----- Method: ModificationForbidden>>defaultAction (in category 'priv handling') ----- - defaultAction - UnhandledError signalForException: self! Item was changed: ----- Method: ModificationForbidden>>indexedMessageText (in category 'printing') ----- indexedMessageText + + ^ 'Cannot modify field {2} of read-only object {1}' translated + format: { + self printObject: object. + fieldIndex }! - ^String streamContents: - [ :s | - s << ' '. - self printObject: object on: s. - s << ' is read-only, hence its field '. - fieldIndex printOn: s. - s << ' cannot be modified with '. - self printObject: newValue on: s]! Item was added: + ----- Method: ModificationForbidden>>isResumable (in category 'priv handling') ----- + isResumable + + ^ true! Item was changed: ----- Method: ModificationForbidden>>nonIndexedMessageText (in category 'printing') ----- nonIndexedMessageText + + ^ 'Cannot execute {2} on read-only object {1}' translated + format: { + self printObject: object. + retrySelector printString }! - ^String streamContents: - [ :s | - s << ' '. - self printObject: object on: s. - s << ' is read-only, hence its selector '. - s << retrySelector. - s << ' cannot be executed with '. - self printObject: newValue on: s]! Item was added: + ----- Method: ModificationForbidden>>printObject: (in category 'private') ----- + printObject: obj + + ^ [obj printString] + ifError: ['<cannot print object>' translated]! Item was removed: - ----- Method: ModificationForbidden>>printObject:on: (in category 'printing') ----- - printObject: obj on: s - [obj printOn: s] - on: Exception - do: [ :ex | s << '<cannot print object>' ]! Item was changed: ----- Method: ModificationForbidden>>resume (in category 'controlling') ----- resume + "Return from the message that signaled the receiver." - "Roll back thisContext to self and resume. Execute unwind blocks when rolling back. ASSUMES self is a sender of thisContext" + ^ self resume: resumptionValue! - self resume: resumptionValue! |
Free forum by Nabble | Edit this page |