A fully late bound namespace proposal

Ralph Johnson johnson at cs.uiuc.edu
Thu Oct 4 13:17:17 UTC 2007


On 10/4/07, Göran Krampe <goran at krampe.se> wrote:
> One way to do this is to compile a global ref as a message send so that:
>
>    Array
>
> ...compiles *as if* it said:
>
>    Smalltalk resolve: #Array
>
> ...or something similar.

Some versions of Smalltalk do something like this.  The bytecodes that
get generated use the Association for the global as the literal, and
send the #value message to read the global and the #value: message to
write it.  However, I just looked at a Squeak method and it looks like
Squeak does something different, that it has special bytecodes for
reading a global.  It would be easy to change, though.

>
> What would above need then? Well, three parts:
>
> 1. Hack Compiler and friends. Not that big a deal actually. No new syntax.

> 2. Implement SystemDictionary>>resolve: in some simple way. The obvious
> way is to just do "self at: key", but we could perhaps add a "remap"
> mechanism from the start so that you can put "redirections" in place.
>
> 3. Implement class Namespace etc, well, my proposal has the approach of
> "simulating" Namespaces within SystemDictionary, if someone else has
> something better that works - fine. We can even have different such
> beasts.

> This sounds even simpler and more backwards compatible than my first
> proposal. ;)

I agree that changing the compiler but NOT changing the VM or changing
syntax is more likely to be backwards compatible, and so easier to get
people to adapt it.

-Ralph Johnson



More information about the Squeak-dev mailing list