Re: Lambda binding solved?

Rafael Bracho (rxb@lion.Eng.Sun.COM)
Mon, 28 Feb 1994 18:30:34 +0800

Steven D. Majewski writes:
> I'm not yet completely sure that arbitrarily nestest namespaces and
> symbol resolution is the best general solution. Perhaps a more
> "pythonish" solution would be to somehow promote Modules into
> something more of a first-class enviromment.
> ...
> Forth - another language that has dictionaries at the core of its
> implementation, calls it's namespace dictionaries "VOCABULARIES"
> and links them together, so search is backwards from the current
> dictionary to the "base" dictionary. However, in Forth, this chained
> lookup happens at compile time ( interpreter compiling into
> threaded-code ) - In Python the symbols are resolved at run time,
> so a costly lookup is to be avoided if possible.

A better match to Python would be PostScript where a dictionary
stack is searched at runtime. In the NeWS implementation, we
added name spaces in the form of 'packages,' themselves being added
to the dictionary stack when "imported." We made packages be
read-only, though they could contain objects (like dictionaries)
which would be read-write. That way, it was possible for the
server to "collapse" all the read-only packages and system dictionary
into one hashed table internally, speeding up lookups at the expense
of making package-adding/deleting slower.

I think that making Modules a first class environment (like packages
in NeWS) is an elegant solution to the name scoping problem. I also
think it's worth thinking about making imported modules read-only,
which would help with implementation details, like faster lookup.

-Rafael