loop/do {...} while EXPR;

4 views
Skip to first unread message

Gerd Pokorra

unread,
May 30, 2005, 5:02:36 AM5/30/05
to perl6-c...@perl.org

Hello!

Why is the do {...} literal added in Pugs 6.2.5?
It would be better that
loop {...} while EXPR;
loop {...} until EXPR;
would work, like it is written in Synopsis 4: Blocks and Statements

Gerd Pokorra

Luke Palmer

unread,
May 30, 2005, 9:42:40 AM5/30/05
to pok...@uni-siegen.de, perl6-c...@perl.org
On 5/30/05, Gerd Pokorra <pok...@uni-siegen.de> wrote:
>
> Hello!
>
> Why is the do {...} literal added in Pugs 6.2.5?

Because do {...} is a part of the language, while or no while. Perl 6
is supposed to die if you say do {...} while, which isn't implemented
in pugs yet. But the special delayed evaluation of the condition
isn't in pugs either, and it shouldn't be.

I expect it should be pretty simple to implement:

> loop {...} while EXPR;
> loop {...} until EXPR;

Luke

Luke Palmer

unread,
May 30, 2005, 11:18:48 AM5/30/05
to pok...@uni-siegen.de, perl6-c...@perl.org
On 5/30/05, Luke Palmer <lrpa...@gmail.com> wrote:
> I expect it should be pretty simple to implement:
>
> > loop {...} while EXPR;
> > loop {...} until EXPR;

Yep. It was. Done as of r4171.

Luke

Larry Wall

unread,
May 31, 2005, 8:15:57 PM5/31/05
to perl6-c...@perl.org
On Mon, May 30, 2005 at 01:42:40PM +0000, Luke Palmer wrote:
: Because do {...} is a part of the language, while or no while. Perl 6

: is supposed to die if you say do {...} while, which isn't implemented
: in pugs yet.

In particular, we'd like "do {...} while" to die because do {...}
is now defined to be the "once" loop, and you can't put two different
loop specifiers on the same block. (Bare blocks are no longer "once"
loops as they are in Perl 5. That functionality has moved to "do".)

Larry

Reply all
Reply to author
Forward
0 new messages