A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-kfr.1339.mcz ==================== Summary ==================== Name: Kernel-kfr.1339 Author: kfr Time: 15 September 2020, 7:48:44.907977 am UUID: 9e1761d0-c2a1-b74a-bfe7-90dd49e320f1 Ancestors: Kernel-ct.1338 Fix a deprecation warning =============== Diff against Kernel-ct.1338 =============== Item was changed: ----- Method: Class>>binding (in category 'compiling') ----- binding "Answer a binding for the receiver, sharing if possible" | binding | + binding := Smalltalk globals associationAt: name ifAbsent: [nil -> self]. - binding := self environment associationAt: name ifAbsent: [nil -> self]. ^binding value == self ifTrue:[binding] ifFalse:[nil -> self].! |
Hi Karl, On Mon, Sep 14, 2020 at 10:48 PM <[hidden email]> wrote: A new version of Kernel was added to project The Inbox: See Environment>>associationAt: aSymbol ifAbsent: aBlock "Senders of this should probably be using #bindingOf:" self flag: #review. ^ declarations associationAt: aSymbol ifAbsent: aBlock So let me suggest Class>>binding "Answer a binding for the receiver, sharing if possible" (self environment bindingOf: name ifAbsent: nil) ifNotNil: [:bindingOrNil| bindingOrNil value == self ifTrue: [^bindingOrNil]]. ^ClassBinding key: nil value: self and then gradually all those anonymous Associations in class methods will disappear :-) _,,,^..^,,,_ best, Eliot |
I tested this change. I get a DNU for 'bindingOf: ifAbsent:' because 'self environment' evaluates to Smalltalk here. Best, Karl On Wed, Sep 16, 2020 at 12:01 AM Eliot Miranda <[hidden email]> wrote:
|
This works: Class>>binding "Answer a binding for the receiver, sharing if possible" (Smalltalk globals bindingOf: name ifAbsent: nil) ifNotNil: [:bindingOrNil| bindingOrNil value == self ifTrue: [^bindingOrNil]]. ^ClassBinding key: nil value: self
On Wed, Sep 16, 2020 at 6:54 PM karl ramberg <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |