[squeak-dev] The Inbox: Environments-ct.83.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Sep 18 13:49:44 UTC 2021


A new version of Environments was added to project The Inbox:
http://source.squeak.org/inbox/Environments-ct.83.mcz

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

Name: Environments-ct.83
Author: ct
Time: 18 September 2021, 3:49:42.977191 pm
UUID: 61ecf3eb-64dc-7541-bf62-1a09b665bef6
Ancestors: Environments-jr.82

Fixes a bug in Environment >> #removeKey:ifAbsent:. Make sure that the previous value of the binding is returned regardless of what the binding policies might do with it during removal.

See http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-August/216287.html. Complements Tests-ct.465. Thanks to Jakob (jr) and Tim (tr) for the feedback!

=============== Diff against Environments-jr.82 ===============

Item was changed:
  ----- Method: Environment>>removeKey:ifAbsent: (in category 'emulating') -----
  removeKey: aSymbol ifAbsent: aBlock
+ 	| binding oldValue |
- 	| binding |
  	self flag: #review.
  
  	(declarations includesKey: aSymbol) ifFalse: [^aBlock value].
  	binding := (declarations associationAt: aSymbol).
+ 	oldValue := binding value. "Store the old value before the binding might be destroyed by a binding policy via #binding:removeFrom:"
  	declarations removeKey: aSymbol.
  	self
  		binding: binding
  		removedFrom: self.
+ 	^ oldValue!
- 	^ binding value!



More information about the Squeak-dev mailing list