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

Non-local GO's



I think that non-local GO's can be implemented at no cost to
non-users, given an appropriate compilation strategy.

Yale's Scheme implementation (also known as T) supports a lexical
catch/throw almost identical to Common Lisp's BLOCK/RETURN-FROM
facility.  The compiler translates lexical throws into direct jumps
(with possible stack adjustment) where this is possible, and uses a more
general CATCH/THROW mechanism where necessary.  I believe that
determining which compilation strategy to use for PROG is the same
problem as that for BLOCK.

If you believe that non-local GO's should be abolished, then you should
also argue against general BLOCK/RETURN-FROM, which I believe will be used
as much if not more than PROG/GO, and so should also allow "efficient"
compilation strategy where its full generality isn't used.

This is perhaps not the place to go into the details of how our compiler
works.  Suffice it to say it can be done (on conventional machines), and
is not particularly hairy.  The key point is that the scope of the GO
tags is lexical, so one can find all the GO's belonging to a particular
PROG.  If no such GO's are from within "uncontrolled" closures then
the compiler needn't use the completely general strategy.

Please let me know if I've misunderstood something about the Common Lisp
spec.