The D Programming Language
Richard A. O'Keefe
ok at quintus.UUCP
Sat Feb 27 21:39:48 AEST 1988
In article <24935 at cca.CCA.COM>, g-rh at cca.CCA.COM (Richard Harter) writes:
> Here is an alternative to endif et al. Use labels to start blocks and
> 'end labels' to end them. For example,
>
> if (boolean expression)
> foo: ....
> end foo
> else
> bar: ....
> end bar
>
He has just re-invented BCPL. Where C has { and }, BCPL had $( and $).
The name for these was "section brackets". There was an extra hack:
"tagged section brackets". If <id> looked like an identifier,
$(<id> and $)<id> were tagged section brackets (each was a single token).
So in BCPL this example would be
TEST boolean-expression THEN
$(FOO
...
$)FOO
ELSE
$(BAR
...
$)BAR
PL/I has a similar feature, one can write
label: DO;
statements
END label; /* I may have this wrong */
There is a difference, though. In BCPL, the tags on the brackets must
match exactly, but in PL/I a tagged END may close any number of tagged
and untagged DOs.
Can anyone who has experience with using this feature suggest why it has
remained rare. In particular, does anyone know why it isn't in C, given
that it was in BCPL? (Not that I think it's needed.)
More information about the Comp.lang.c
mailing list