develooper Front page | perl.perl6.language.flow | Postings from August 2000

Re: The distinction between "do BLOCK while COND" and "EXPRwhile COND" should go

Thread Previous | Thread Next
From:
Peter Scott
Date:
August 31, 2000 06:48
Subject:
Re: The distinction between "do BLOCK while COND" and "EXPRwhile COND" should go
Message ID:
4.3.2.7.2.20000831064524.00aa75e0@psdt.com
At 11:38 AM 8/31/00 +0200, Bart Lateur wrote:

>The articial distinction between
>
>         do BLOCK while condition;
>
>and
>
>         EXPR while condition;
>
>should go, because the former is nothing but a subcase of the latter.
>Currently, the former executes the do BLOCK at least once, while the
>latter tests the condition before doing the first loop -- and possibly
>skipping it. Either both should do the test first, or execute at least
>once.

I don't agree.  I find both intuitive.  The second case is a postfix 
modifier, so my brain translates it to "shorthand for while (condition) { 
EXPR }".  To change its semantics would break the symmetry of statement 
modifiers.  The first case is the same syntax and semantics as several 
languages I can recall using, although I'm too burned out at the moment to 
think what they are; but it's quite intuitive nonetheless.

Get rid of some of the other weird uses of 'do', yes...
--
Peter Scott
Pacific Systems Design Technologies


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About