[net.lang.st80] cascades, for the third time

budd@arizona.UUCP (tim budd) (10/27/84)

Well, i guess my last two submissions to this group show that

1. i had misread the semantics of cascades, and
2. cascades are sort of odd

perhaps i deserve the james watt memorial shooting yourself in the foot
award, at least for one day.  At the risk of losing whatever credibility i
may have left, i hereby wish to propose the semantics cascades *should* have
had - and why i think they are preferable to the blue book semantics.

let us call a message passing expression minus a receiver a ``continuation''
(an example is `` + x - z negated '').
The semantics of

	whatever-a ; whatever-b

Where whatever-b is a continuation, is then as follows:
1. the value of the expression is the value of whatever-a.
2. the receiver for whatever-b is the value of 1, the value of whatever-b
is thrown away.
3. the entire sequence is an expression, with all the rights and
responsibilities that entails.  For example, another continuation can be
added, with the obvious meaning:

	whatever-a ; whatever-b ; whatever-c

the final result is still the result of whatever-a, which is used as the
receiver for both whatever-b and whatever-c, and results of which are both
thrown away.

The differences between this and the bluebook semantics are as follows:
1. continuations can involve an arbitrary number of messages, not just one.
2. the receiver for each continuation is the result of the expression before
the first semicolon, not the receiver for the last message sent before the
first semicolon.

there is, of course, a slight shift/reduce problem, analogous to the
dangling else problem in algol like languages.  that is, given the
expression
	whatever-a ; whatever-b foo
the unary message foo can either be interpreted as being part of
whatever-b, or as being sent to the result of the cascaded expression, that
is:
	(whatever-a ; whatever-b ) foo
the former should be the correct interpretation, since if you want the
latter interpretation you just use parentheses.

why is the preferable to the blue-book construct?
1. it makes it clear what the receiver for each of the continuations is,
rather than having to strip off one layer of message passing to discover
this.
2. the continuations can involve more than one message, which is
occasionally useful.
3. it makes cascades a more conventional type of expression, rather than
being something special.

(4. its how i always thought they should work, anyhow :-) )

--tim budd.