[squeak-dev] The Inbox: Morphic-ct.1905.mcz

christoph.thiede at student.hpi.uni-potsdam.de christoph.thiede at student.hpi.uni-potsdam.de
Thu Feb 24 16:42:44 UTC 2022


Ouch, I overlooked this. Thank you for the fast feedback! merged via Morphic-ct.1906. :-)

Best,
Christoph

---
Sent from Squeak Inbox Talk

On 2022-02-24T12:17:34+01:00, marcel.taeumel at hpi.de wrote:

> Hi Christoph --
> 
> +1 but be careful to answer 'nil' in such cases:
> 
> ...
> otherProperties ifNil: [^ self].
> 
> ...
> 
> Best,
> Marcel
> Am 24.02.2022 11:59:30 schrieb commits at source.squeak.org <commits at source.squeak.org>:
> A new version of Morphic was added to project The Inbox:
> http://source.squeak.org/inbox/Morphic-ct.1905.mcz
> 
> ==================== Summary ====================
> 
> Name: Morphic-ct.1905
> Author: ct
> Time: 24 February 2022, 11:59:10.222147 am
> UUID: ac4eb336-4623-5f48-9485-b4e46c636580
> Ancestors: Morphic-mt.1904
> 
> Proposal: For Morph extensions, establish 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:
> 
> =============== 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."
> - "removes the property named aSymbol if it exists"
> extension ifNil: [^ self].
> + ^ extension removeProperty: aSymbol!
> - 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."
> - "change the receiver's property named aSymbol to anObject"
> anObject ifNil: [^ self removeProperty: aSymbol].
> + ^ self assureExtension setProperty: aSymbol toValue: anObject!
> - 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 |
> - "removes the property named aSymbol if it exists"
> otherProperties ifNil: [^ self].
> + value := otherProperties removeKey: aSymbol ifAbsent: [].
> + otherProperties isEmpty ifTrue: [self removeOtherProperties].
> + ^ value!
> - 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!
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220224/b9e5fbce/attachment.html>
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220224/58937471/attachment.html>


More information about the Squeak-dev mailing list