A lightweight namespace "proposal"

Bert Freudenberg bert at impara.de
Thu Apr 22 09:39:49 UTC 2004


Am 22.04.2004 um 01:52 schrieb Peter van Rooijen:
> The classes that are now already in the base image, can (and should, 
> in my opinion) all go in the same namespace. No Collection::Set, 
> Magnitude::Float or Network::Socket (these are examples of 
> namespace/package confusion).
>
> I would advocate keeping it all very simple by making the root 
> namespace have *no name*. This makes the root namespace unique 
> syntactically and avoids all discussion about naming it Smalltalk, 
> Squeak, Root, or whatever.
>
> So you write Set to refer to whatever Set is seen/visible from where 
> (i.e., in which namespace) the code is, and if you absolutely want the 
> one in the root namespace, you write ::Set. This suggests that if you 
> write Set and you are in the namespace SqueakMap, you will get 
> SqueakMap::Set if it exists, so it suggests the possibility of 
> shadowing, which I in fact advocate.
>
> Of course if you write Set and your code is in the root namespace, it 
> can only refer to ::Set. Very nice for existing code in the 
> distribution images, it is not affected at all :-).

+1

- Bert -




More information about the Squeak-dev mailing list