[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RETURN-FROM inside a FINALLY
Date: Sun, 17 Sep 89 18:51 EDT
From: Glenn S. Burke <gsb@ALDERAAN.SCRC.Symbolics.COM>
The Genera model of LOOP naming and returns is really the Zetalisp model
of PROG naming and returns of several years ago. Under this model, and
ignoring "transparent" PROGs, RETURN always from the innermost PROG,
irrespective of its name. As Genera has developed, these semantics have
been carefully preserved in loop.
To be clear: this is not a property of RETURN. Genera's RETURN (both Zetalisp
and Common Lisp) preserves the equivalence with RETURN-FROM NIL. It is a
property of PROG. Symbolics' extension (PROG name var-list tagbody...)
adds a block name, rather than changing the block name from NIL to name.
I am of the opinion that LOOP, with a single NAMED clause, should
establish a single block with that name, and not establish a block named
NIL. I do not believe this to be a correction or even clarification of
any kind; documentation of the NAMED clause is quite explicit. However,
X3J13/89-004 p. 2-36 says the clause "RETURN <value>" is equivalent to
"DO (RETURN <value>)", and this should be corrected to something like
"DO (RETURN-FROM <loop-name> <value>)" with reference to the NAMED
This is interesting. GSB wants the LOOP standard to behave like Lucid's
implementation, while JonL wants the LOOP standard to behave like
Symbolics Genera's implementation. At least no one can be accused of
putting their company's commercial interests above the interests of the
It is surely useless for the RETURN clause in a named loop to be an
error, and it is worse than useless for it to return from something
other than the loop. Thus either the equivalence from p.2-36 is wrong,
or the NAMED clause should add a name rather than removing the name NIL.
It has also been suggested that the NAMED clause should be modified so
that multiple NAMED clauses are permitted. With no NAMED clause the
LOOP establishes one block named NIL; with one or more NAMED clause, the
LOOP establishes that many blocks, one with each name. This is
something that has cropped up as a possible extension in the past. In
the case of this incompatibility, would aid in mechanical conversion of
Genera-style loop to ANSI-style with minimal textual change. Anyone
else have any feelings about this?
This would be an okay extension, although it's not really necessary since
the user can just nest BLOCKs around the LOOP. I don't think this extension
is a good substitute for fixing the conflict between the RETURN and NAMED
I will also suggest an Alexandrian solution to this Gordian knot: remove
the NAMED clause from the language. Then all LOOPs are named NIL and there
is no question of what the RETURN clause does. This is consistent with
CLtL, which eliminated the named forms of PROG and DO when it adopted those
constructs from its predecessor languages.
I do not yet have a considered opinion, but currently I prefer eliminated
the NAMED clause.