Name spaces in Spoon

goran at goran at
Fri May 26 19:57:45 UTC 2006


"Alejandro F. Reimondo" <aleReimondo at> wrote:
> Hi,
> > > It was something like Prefix::ClassName and the point was that only
> > > one or two places in the image had to change to legalize that kind of
> > > name.
> > Yes, the patch to get a Squeak image to accept code using such global
> > names is very, very small.
> What do you think about sending the name
>  as message...
>     MyGlobalContext::ThisClass
>  becomes:
>     MyGlobalContext ThisClass
>  the global context (aNameSpace, anEnvironment
>  or SystemDictionary)
>  can respond to the message returning the real
>  object (or via dnu build a method to return it)
> Using this "trick" we do not need new syntax
>  and the solution is solved as usual (sending messages).
> bets,
> Ale.

Just wish to note that this approach was indeed tested IIRC in the
3.3modules code, and if my memory serves me right Dan proposed it - but
I am not sure. Personally I was hesitant at the time, and still is.

A few comments:

1. It would move the binding time to runtime instead of compile time (or
if you prefer to call it "code install"-time). I can probably imagine
both pros and cons with that. It is a big change.

2. In my personal opinion it is less readable than
MyGlobalContext::ThisClass. It blends into the rest of the code so that
the reference itself doesn't "stand out". It also deviates from the
"words beginning with capitals refer to classes (or globals)".

3. The :: solution actually does not "need new syntax". It just needs us
to allow $: in global names. Sure, you can call it a "syntax change" -
but it is very, very small.

regards, Göran

More information about the Squeak-dev mailing list