Article View: comp.lang.misc
Article #5451Re: Loops
From: Erland Sommarskog
Date: Thu, 14 Apr 1988 10:32
Date: Thu, 14 Apr 1988 10:32
37 lines
2276 bytes
2276 bytes
Dr A. N. Walker (anw@nott-cs.UUCP) writes:
>Joe Keane (jk3k+@andrew.cmu.edu) writes:
>>While i'm at childish flaming, i might as well say that i _really_ hate `fi',
>>`rof', `esac', and `elihw'. Can anyone say they're a good idea and keep a
>>straight face?
>
> Yes. "They're a good idea." :-|
>
> What's your problem -- the concept of closing off the loop properly,
>or the actual words? OK, the actual words aren't marvellous, but no-one has
>suggested anything better that I know of (I don't rate `end_if' and its
>relatives very highly), and they have an obvious provenance that goes well
>with the usual mathematical convention for paired brackets.
The bad point with words like "esac" is that you have to read them twice,
at least, to see what's going on. The sole advantage over "end case" is
that you save some keys to type. Whereas this seem to have been an important
issue in some languages and operating systems, I wouldn't count that at all.
"End case" is clearer. It also have the advantage that you only have to
read "end" if you're just taking a quick glance; The fact that it is the
end of a case-statement may be irrelevant at the moment.
Ada has "end if", "end loop", "end case" and "end <name>". Unfortunately
you can leave out names in end-statements for procedure and packages.
And for blocks you can only have "end <name>" if you name the block,
which you rarely do. (At least not me.) "end block" would be something.
Note also that "end if" (or "fi" or whatever") helps you little when
you have many nested if-statements. You're just as bad out as with
only "end", unless you add a comments like:
end if; -- test A
end if; -- test B
--
Erland Sommarskog
ENEA Data, Stockholm - Hey, aren't you playing this record at 45 rpm?
sommar@enea.UUCP - No, you're listening to Rush.
Technical Details
Message-ID:
<3041@enea.se>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!enea!sommarReferences:
<YWK3hUy00VA88IO0UA@andrew.c <557@tuck.nott-cs.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!enea!sommar From: sommar@enea.se (Erland Sommarskog) Newsgroups: comp.lang.misc Subject: Re: Loops Message-ID: <3041@enea.se> Date: 14 Apr 88 10:32:23 GMT References: <YWK3hUy00VA88IO0UA@andrew.c <557@tuck.nott-cs.UUCP> Reply-To: sommar@enea.UUCP(Erland Sommarskog) Followup-To: comp.lang.misc Organization: ENEA DATA AB, Sweden Lines: 37