[squeak-dev] Eager Import

Colin Putney colin at wiresong.com
Sat Jan 4 23:13:50 UTC 2014


On Wed, Jan 1, 2014 at 5:15 PM, Levente Uzonyi <leves at elte.hu> wrote:

> I took a quick look, and found two issues so far.
>
> Environment >> #bindingOf:ifAbsent: returns bindings from undeclared:
>
> bindingOf: aSymbol ifAbsent: aBlock
>         ^ bindings bindingOf: aSymbol ifAbsent:
>                 [undeclared bindingOf: aSymbol ifAbsent: aBlock]
>
> This fools Shout and the rest of the system, making them "think" that any
> missing instance variable which has a method referencing it exists.
> A good example is Environment's exports variable, which was deleted, but
> the #exports accessor is still in the image, and it's referencing it. So I
> can compile any method using the exports variable, and neither Shout, nor
> the compiler will complain. This is the reason why ReleaseTest >>
> #testUndeclared is still failing.
>


Argh. I keep making this mistake, because that's obviously how it should
work. Of course, despite being obvious, this intuition is just wrong. I've
added some tests that should catch this sort of mistake in the future.


> Is there a reason to return bindings from Undeclared from
> #bindingOf:ifAbsent:?
>
>
> The other issue is related to the handling of Undeclared. Dictionary >>
> #unreferencedKeys - which is used during #cleanOutUndeclared - ignores the
> current Environment and uses the classes of the global environment.
> The Environment itself should provide a method to remove the unreferenced
> bindings from its own Undeclared.
>

It does—#purgeUndeclared. We just need to send that message to the right
environment. I suspect that senders of #cleanOutUndeclared should
deprecated, and all the existing senders should be rewritten to send
#purgeUndeclared to the appropriate environment.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20140104/e439d993/attachment.htm


More information about the Squeak-dev mailing list