"while/else" (ugh) (was Re: [oclug] Ruby)
Michael P. Soulier
msoulier at digitaltorque.ca
Fri Jun 27 15:39:08 EDT 2003
On 27/06/03 David F. Skoll did speaketh:
> That's really ugly. How does "else" come into it? The behavior
> doesn't match what I'd expect intuitively. (By "intuitively",
> I mean something matching the English definition of "else" at
> http://dictionary.reference.com/search?q=else)
>
> In this case, I would even prefer a goto, as it's clearer:
>
> while(condition) {
> do_something;
> if (something_extreme) goto escape
> }
> // cleanup code (the "else" stuff) goes here.
>
> escape:
> // We skipped past the cleanup code.
>
> Anyone can understand that, but hardly anyone understood the "else"
> thing.
Perhaps, but I doubt it's the only programming construct that few
people understand when they see it for the first time.
How about upvar in Tcl? Pointers in C? Just about anything in C++?
The list goes on. That doesn't make them any less useful.
Mike
--
Michael P. Soulier <msoulier at digitaltorque.ca>, GnuPG pub key: 5BC8BE08
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort." -Harley Hahn, A Student's Guide to Unix
IM: msoulier at jabber.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://tux.oclug.on.ca/pipermail/oclug/attachments/20030627/86e8c380/attachment.bin
More information about the OCLUG
mailing list