Christoph Thiede uploaded a new version of Morphic to project The Trunk: http://source.squeak.org/trunk/Morphic-ct.1906.mcz
==================== Summary ====================
Name: Morphic-ct.1906 Author: ct Time: 24 February 2022, 5:41:18.342147 pm UUID: 4cdef9c0-ecb4-1c40-bb54-8fd5153939e6 Ancestors: Morphic-mt.1904
For Morph properties, establishes the common return value semantics known from most other collection protocols. I.e., #setProperty:... now answers the added value and #removeProperty: answers the removed value.
This can also help us to clean up a number of senders, browse this for an impression: self systemNavigation browseAllCallsOn: #removeProperty: and: #valueOfProperty:
Thanks to Marcel for the review! Treats Morphic-ct.1905.
=============== Diff against Morphic-mt.1904 ===============
Item was changed: ----- Method: Morph>>removeProperty: (in category 'accessing - properties') ----- removeProperty: aSymbol + "Remove the property named aSymbol if it exists. Answer the old value or nil." + extension ifNil: [^ nil]. + ^ extension removeProperty: aSymbol! - "removes the property named aSymbol if it exists" - extension ifNil: [^ self]. - extension removeProperty: aSymbol!
Item was changed: ----- Method: Morph>>setProperties: (in category 'accessing - properties') ----- setProperties: aList + "Set many properties at once from a list of prop, value, prop, value. Answer the list." - "Set many properties at once from a list of prop, value, prop, value"
1 to: aList size by: 2 do: [:ii | + self setProperty: (aList at: ii) toValue: (aList at: ii+1)]. + ^ aList! - self setProperty: (aList at: ii) toValue: (aList at: ii+1)].!
Item was changed: ----- Method: Morph>>setProperty:toValue: (in category 'accessing - properties') ----- setProperty: aSymbol toValue: anObject + "Change the receiver's property named aSymbol to anObject. Answer anObject." + anObject ifNil: [ + self removeProperty: aSymbol. + ^ anObject]. + ^ self assureExtension setProperty: aSymbol toValue: anObject! - "change the receiver's property named aSymbol to anObject" - anObject ifNil: [^ self removeProperty: aSymbol]. - self assureExtension setProperty: aSymbol toValue: anObject!
Item was changed: ----- Method: MorphExtension>>removeProperty: (in category 'accessing - other properties') ----- removeProperty: aSymbol + "Removes the property named aSymbol if it exists. Answer the old value or nil." + | value | + otherProperties ifNil: [^ nil]. + value := otherProperties removeKey: aSymbol ifAbsent: []. + otherProperties ifEmpty: [self removeOtherProperties]. + ^ value! - "removes the property named aSymbol if it exists" - otherProperties ifNil: [^ self]. - otherProperties removeKey: aSymbol ifAbsent: []. - otherProperties isEmpty ifTrue: [self removeOtherProperties]!
Item was changed: ----- Method: MorphExtension>>setProperty:toValue: (in category 'accessing - other properties') ----- setProperty: aSymbol toValue: abObject + "Change the receiver's property named aSymbol to anObject. Answer anObject." + ^ self assureOtherProperties at: aSymbol put: abObject! - "change the receiver's property named aSymbol to anObject" - self assureOtherProperties at: aSymbol put: abObject!
packages@lists.squeakfoundation.org