[squeak-dev] The Inbox: Kernel-ul.1415.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Wed Sep 22 12:20:16 UTC 2021


+1

Best,
Marcel
Am 21.09.2021 00:21:19 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Levente Uzonyi uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-ul.1415.mcz

==================== Summary ====================

Name: Kernel-ul.1415
Author: ul
Time: 21 September 2021, 12:15:33.429302 am
UUID: 475b52e5-ca1e-4e9a-bf3f-bdc55f143e01
Ancestors: Kernel-eem.1414

MethodDictionary has to reimplement some inherited methods: #add, #at:ifPresent:ifAbsentPut: and #replace:

=============== Diff against Kernel-eem.1414 ===============

Item was added:
+ ----- Method: MethodDictionary>>add: (in category 'adding') -----
+ add: anAssociation
+
+ self at: anAssociation key put: anAssociation value.
+ ^anAssociation!

Item was added:
+ ----- Method: MethodDictionary>>at:ifPresent:ifAbsentPut: (in category 'accessing') -----
+ at: key ifPresent: oneArgBlock ifAbsentPut: absentBlock
+ "Lookup the given key in the receiver. If it is present, answer the value of
+ evaluating oneArgBlock with the value associated with the key. Otherwise
+ add the value of absentBlock under the key, and answer that value."
+
+ | index value |
+ index := self scanFor: key.
+ (array at: index) ifNotNil: [ :element | ^oneArgBlock value: element value].
+ value := absentBlock value.
+ self
+ basicAt: index put: key;
+ atNewIndex: index put: value.
+ ^value!

Item was added:
+ ----- Method: MethodDictionary>>replace: (in category 'enumeration') -----
+ replace: aBlock
+ "Destructively replace the values in this Dictionary by applying aBlock, keeping the same keys."
+
+ tally = 0 ifTrue: [ ^self].
+ 1 to: array size do: [ :index |
+ (array at: index) ifNotNil: [ :element |
+ array at: index put: (aBlock value: element) ] ]!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210922/3ee52fc7/attachment.html>


More information about the Squeak-dev mailing list