[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Variable binding

I think the message you sent just previously, about the
"package system," is related to the issue of having procedure
variables be lexically scoped. As you said, the way
we use procedures now are as lexically scoped variables.
I even enforce this view in the Macsyma->Lisp translator, e.g.
"F(G):=H(1)+G(1)" "H(1)" has "H" lexical-global, while "G(1)" turns
into "(FUNCALL G 1)." The Macsyma-User never knows the
difference, in fact he doesn't really seem to think about
it much. (Obviously this breaks down entirely in the cases
where the Macsyma-System-Programmer has written an FSUBR
that depends heavily on VARIABLES being SYMBOLS, etc.)

Anyway, the claim is that if you have lexically scoped
procedure variables you don't need a package-system.
What you do need is seperate compilation of the elements
of a LABELS statement, e.g.

(DEFENV BAZ ()             ; define an environment
 (LABELS ((FOO "foo")      ; the LAMBDA is in the file "foo"
          (BAR "bar"))     ; the LAMBDA is in the file "bar"

If you want to call the function FOO from outside of the
environment BAZ then maybe you say ((BAZ FOO) 1 2 3).
Define ":" as an infix operator and you can say (BAZ:FOO 1 2 3).

I don't know, maybe this sounds too much like PL/1 on Multics.