Modules vs name spaces (Was: Global namespace)
Henrik Motakef
usenet-reply at henrik-motakef.de
Thu Oct 30 16:53:42 EST 2003
Harald Hanche-Olsen <hanche at math.ntnu.no> writes:
> But the read-time vs run-time (or compile-time) distinction makes more
> sense to me. If a python function references foo.bar then by changing
> the value of foo I can make the function refer to a different foo.bar,
> but if a Common Lisp function references foo:bar, then messing around
> with the FOO package is never going to change the meaning of that
> reference.
Well, not quite. It will still use the same /symbol/ foo:bar, but its
SYMBOL-FUNCTION may change, of course.
* (defpackage :p1 (:use :cl))
#<PACKAGE "P1">
* (defpackage :p2 (:use :cl))
#<PACKAGE "P2">
* (in-package :p1)
#<PACKAGE "P1">
* (defun foo () :first-definition)
FOO
* (in-package :p2)
#<PACKAGE "P2">
* (defun bar () (p1::foo))
BAR
* (bar)
:FIRST-DEFINITION
* (defun p1::foo () :second-definition)
STYLE-WARNING: redefining P1::FOO in DEFUN
FOO
* (bar)
:SECOND-DEFINITION
More information about the Python-list
mailing list