Hey, a namsepaces discussoin! (Was: Re: Partitioning the image (was Re: Shrinking sucks!))

Reinout Heeck reinz at desk.org
Fri Feb 25 06:30:59 UTC 2005


Lex Spoon wrote:
> Sounds nice!
>
> Do you know, Reinout, how hard has this namespaces approach been pushed?
>  How large of Forth programs are there?

I searched a bit for you but couldn't find relevant info. Perhaps better ask 
this question in comp.lang.forth.

I think they are scaleable because the number of vocabularies to search during 
a load is independent of the number of vocabularies available in the image.


>
> I believe Python has a mechanism for this kind of local namespaces, by
> the way.  By default, namespaces are based on files.  However, if you
> invoke the loader in the right way, you can load a package and specify
> what namespaces it can see.  This was used in the Grail web browser to
> allow secure execution of Python code within a web browser.  The
> sandboxed code simply could not see global variables that are dangerous.

In a web of vocabularies there are no globals! :-))))

A piece of code being compiled only has bindable names in its environment (or 
'visible globals' or 'reachable globals' if the reader wishes to insist on 
using the term 'global').

I also think it is important to separate the target namespace from the lookup 
namespaces like Forth does. Unfortunately a lot of languages hardwire the 
target to be the first namespace on the lookup chain, they have to revert to 
absolute names if you need to reference an object by a same name as you are 
compiling (eg where an electrical Socket class being compiled needs to 
reference a network Socket class we want the network vocabulary on top of the 
search order, not the electrics vocabulary which is the target being compiled 
into). Some languages provide a 'with' construct to overcome this problem.

>
> And to get obscure, I remember that one of the job-submission languages
> on IBM mainframes, lets you connect the logical files of the program you
> are running, to physical files of your choice; then, programs do not
> ever open a filename in the general filesystem.  Instead, they talk only
> to virtual file systems.  So, this idea of the "global" space being
> specified by another component, has been used in some strange places!

Yes, there is large overlap of concepts with capabilities based systems as 
long as you don't introduce absolute names (and by implication a 
distinguished root namespace).


R
-



More information about the Squeak-dev mailing list