[net.lang.c] Can an unneeded value be void? An APL perspective

gnu@hoptoad.uucp (John Gilmore) (08/12/86)

This whole discussion of e? void1(): void2(); reminds me of a similar
circumstance in the APL world many years ago.

People were just getting around to defining a new function "execute",
which would take a character vector containing an expression and
would run it as an APL statement.  The question was:  suppose it
didn't return a value?

The eventual answer was that if the expression didn't return a value,
then "execute" didn't return a value either.  If somebody wanted
that value (e.g. to assign to a variable) then a "VALUE ERROR"
would occur at that point.  If the execute was a "leftmost execute"
(execute was the leftmost function on the line) then it is a
complete statement and no value is required.

In the context of C's ? operator, you can think of it similarly.
'?' can be allowed to return a void value in some circumstances.
If you said

	a = e? v1(): v2();

then you'd get an error -- but not "inside" the ?.  The error
arises in assignment of ?'s result, just as if you had said:

	a = v1();

This argument only seems to come up with flow-of-control operators
which can be embedded in expressions.  Traditional flow control
*statements* don't occur in expressions so nobody notices.  What
does LISP or ALGOL 68 do for this stuff?]

[I support the use of ? with voids but this is more to explain
how the APL world saw a similar problem, than to argue for either way.]
-- 
John Gilmore  {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu   jgilmore@lll-crg.arpa
		     May the Source be with you!