Changes by: Jason Hickey (jyh at cs.caltech.edu)
Date: 2005-07-03 07:13:42 -0700 (Sun, 03 Jul 2005)
Revision: 1182
Log message:
Experimenting with variable scoping.
This was an attempt to delay variable linking until runtime,
which is desirable because you would like to have computed
opens.
open $(STDLIB)/foo
X = 1
It doesn't really work because when the definition of X is encountered
at parse time, it isn't known what module it belongs to. Since it isn't
known, the variable summary for this file can't be computed.
There are two solutions.
1. Make the open static, so scoping can be determined
at parse time.
# Find foo using the static search path
open foo
This is the way most languages do it, but it is
unsatisfying for omake.
2. Keep dynamic opens, and keep a linkage section for each
file that can be computed without evaluating the entire
file. It gets a little messy because of nested opens,
but the nice thing is that opens are statically scoped,
so nested opens do not affect the top-level definitions.
open $(A)
# link X, Y
if blah
X = 1
export
else
open $(B)
# link Y
Y = 1
export
println($(Y))
I'll try doing 2.