[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: first-class names
From: <mike@newhall.net>
>
> > Remember that the compiler isn't the only tool you might want to run on
> > the code. Since the expression above is statically indeterminate if you
> > allow the user to manipulate the environment structure, you cannot
> > statically determine the type of the expression either, nor prove
> > that it terminates, nor prove that it does not cause an error to be
raised,
> > nor prove that it is side-effect free, nor prove that procedure `foo' is
> not
> > called, nor prove that it does not capture it's continuation,
> > etc.
> >
> > That's an awful lot to give up.
>
> It is an awful lot to give up. But could you lexically scope
> first-class environments? Not the reification itself, but the ability to
> reify, and break the analyzability of the code only in the subtrees using
> them?
You *can* statically determine if someone within your scope
calls THE-ENVIRONMENT (that's what it's called in MIT
Scheme, and it's a special form). If you don't use that form, then
you cannot reify the environment `from the inside', and MIT Scheme
won't let you reify a compiled environment `from the outside'.
So if you don't call THE-ENVIRONMENT the compiler will
generate *much* better code than if you do. (If you *do* call
THE-ENVIRONMENT, however, the compiler lays out every
variable in an interpreter-compatible way and does the deep
search.)