From: "Paul Smith":
> > > On Mon, 2008-04-21 at 10:43 -0700, Brian
Dessent wrote:
> > > > CFLAGS = $(filter-out
-D_REMOVE_THIS_,$(CFLAGS))
> The example above is quite simple, but consider more
complicated
> situations where the expansion is quite complex,
referencing lots of
> variables (not just one), each of which has a number of
historical
> values. The same variable could even be referenced by
more than one of
> these values. So, while expanding a variable you have
to remember how
> far down the value stack you've gone and that has to be
remembered
> individually for each variable and potentially for each
INSTANCE of each
> variable.
> Maybe I'm making it more confusing than it needs to be,
but I don't
> think so.
Well, details may still be tricky of course, but the basic
logic
could be quite easy.
Assume there is a function that expands variable from its
name,
so this function would just pop a value from it's history,
expand it, and then put it back again. Basically like this:
expand_var(NAME):
var = find(NAME)
val = pop(var->history)
result = expand(val)
push(val, var->history)
return result
Such any recursive reference always sees only the earlier
value, and
each variable handles its stack individually. Behaviour wrt.
other
variables is unmolested, they still have the usual "pan
scope" in
place (or whatever you name it). For example:
V = A
W = B
V = $V $W $V
W = $W C $W
expand V --> A B C B A
--- grischka
_______________________________________________
Help-make mailing list
Help-make gnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
|