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

Re: GO in T?

Out of curiosity, I looked for all of the GOs in the Maclisp library
files.  In 65 files, 27 contained GOs, with a total of 525 occurences
Every single one would be covered by #2 of your options, i.e. they were
all sufficiently tail recursive, given some simple transformations.
I believe Common Lisp permits very bizarre placement of GOs, such as in
a value-expecting position.  A GO in such a position would have to be
handled with a CATCH somehow.  Of course, since translating such code
will require some analysis, not just a simple macroexpansion, it would
be easy enough to detect such a case and handle it with one of your
other schemes.

Translating Algol-like languages should be much easier for the most
part, since they are mostly statement-based rather than
expression-based, so you would never encounter a GOTO in a
value-expecting position.  A complication you would not encounter in
translating clotty and rancid old Lisp code (but allowed in Common Lisp)
is GOTOs out into an enclosing dynamic contour, e.g.

program foo;

  label 999;

  procedure bar;
  if unrecoverable_error then goto 999;


These can be used in Pascal as THROW equivalents, although many
implementations do not allow them.

It wouldn't be the end of the world if you added TAGBODY and GO to T.
As you say, Lisp isn't a police state.  Anyone who can abuse GOs can
abuse LABELS just as badly.