[virtmach] bytecodes and stacks
29 Nov 1999 11:13:58 +0000
> >The questions are:
> >Is it possible to just push/pop things off one stack, allowing for things
> >like global-variables and locally bound ones (eg. let in scheme)? or would
> >several be needed, leading to a towers of hanoi like situation, when you
> >needed to reference a variable form an earlier "stack frame", not a fun
> I'm in the early stages of trying something similar (a VM to execute
> byte-codes generated from scheme code). I discovered that I couldn't
> simply push and pop things off a frame stack because of the existence of
> environment closures.
ISTR reading in the SML implementation literature (of which there is a
*lot*) that it is in fact true that a stack is enough, even in the
presence of first-class & higher-order functions, although you have to
be careful about how you form closures.
Now that I think about it, that might apply more properly to ML than
Scheme, since ML values are not mutable (names are bound to actual
values), while Scheme names are bound to value references (because of
the presence of set!). You should be able to model the Scheme approach
in an ML-style system, but I imagine that it wouldn't be so pleasant.
Censorship may be useful for preservation of morality, but can never
be so for its restoration. - Jean-Jacques Rousseau