[squeak-dev] The Inbox: Environments-ul.43.mcz

Colin Putney colin at wiresong.com
Mon Dec 30 05:24:22 UTC 2013


On Sun, Dec 29, 2013 at 4:15 PM, <commits at source.squeak.org> wrote:

Item was changed:
>   ----- Method: Environment>>at:ifAbsentPut: (in category 'emulating')
> -----
>   at: aSymbol ifAbsentPut: aBlock
> +
> +       ^declarations
> -       ^ declarations
>                 at: aSymbol
> +               ifAbsent: [ self at: aSymbol put: aBlock value ]!
> -               ifAbsentPut: aBlock!
>


Yup. We want to make use of the new become logic in #at:put: here too...


Item was changed:
>   ----- Method: Environment>>at:put: (in category 'emulating') -----
>   at: aSymbol put: anObject
> +
> +       | binding newBinding |
> +       newBinding := aSymbol => anObject.
> +       binding := declarations associationAt: aSymbol ifAbsent: [ nil ].
> +       binding ifNotNil: [
> +               binding class == newBinding class
> +                       ifTrue: [ binding value: anObject ]
> +                       ifFalse: [ binding becomeForward: newBinding ].
> +               ^anObject ].
> +       binding := undeclared associationAt: aSymbol ifAbsent: [ nil ].
> +       binding
> +               ifNil: [ binding := newBinding ]
> +               ifNotNil: [
> +                       undeclared removeKey: aSymbol.
> +                       binding class == newBinding class
> +                               ifTrue: [ binding value: anObject ]
> +                               ifFalse: [ binding becomeForward:
> newBinding ] ].
> +       declarations add: binding.

+       references add: binding.
>

I think the above line is problematic. It by by-passes all the
import/export logic.


+       exports bind: binding. "Do we really want this?"
>

Yes.


+       ^anObject
>
> Item was changed:
>   ----- Method: Environment>>removeKey:ifAbsent: (in category 'emulating')
> -----
>   removeKey: key ifAbsent: aBlock
> +
> +       (declarations includesKey: key) ifFalse: [ ^aBlock value ].
> +       references removeKey: key ifAbsent: [].
>

Again, the above line by-passes all the import/export logic.


Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20131230/092d34b3/attachment.htm


More information about the Squeak-dev mailing list