Modules vs name spaces (Was: Global namespace)
Erann Gat
gat at jpl.nasa.gov
Thu Oct 30 17:25:15 EST 2003
In article <pcoism6flxx.fsf at thoth.math.ntnu.no>, Harald Hanche-Olsen
<hanche at math.ntnu.no> wrote:
> | Modules work at compile time or run time depending on the module system.
> |
> | Common Lisp has a package system but no module system (but it's possible
> | to add one -- see e.g. http://www.flownet.com/gat/locales.pdf).
>
> Ah. I had read that one before, but never realized that it describes
> a module system. That gives me some idea what it's all about.
> Thanks.
I really should have called them modules, not locales. (Maybe I'll change
the name in the next version.) Locale nowadays has to do with
internationalization. But I chose the name out of respect for the
original design in T.
> | Python has a module system that works at run-time, but no package system.
> |
> | Does that help?
>
> Now I am getting a bit confused once more, since python doesn't have
> symbols, and so the distinction between modules and packages gets
> blurred (in my mind at least): A python modules maps strings directly
> to values without symbols ever entering the discussion.
That's right. That's why I wrote:
> Modules map symbols/identifiers onto values.
instead of just "modules map symbols onto values."
Lisp uses symbols (and sometimes other things as well) as identifiers.
Python uses strings.
> I guess what I am saying is that, while packages without symbols don't
> make sense, modules don't require them. But then, neither did you
> say they do, now that I read what you said over again.
That's mostly right. At some point you run into the problem of defining
what a symbol is. In some contexts "symbol" means nothing more than
"uniquified string", in which case Python strings are really symbols:
>>> "foo" is "foo"
1
In Common Lisp symbols have extra stuff attached to them, and the term
"keyword" is sometimes used to refer to a uniqified string without that
extra stuff. But this usage is far from universal.
E.
More information about the Python-list
mailing list