[squeak-dev] The Inbox: Kernel-kfr.1339.mcz

Eliot Miranda eliot.miranda at gmail.com
Tue Sep 15 22:00:57 UTC 2020


Hi Karl,

On Mon, Sep 14, 2020 at 10:48 PM <commits at source.squeak.org> wrote:

> 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].!
>

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200915/51b9630c/attachment.html>


More information about the Squeak-dev mailing list