RFC: Behavior of continue in do/while loops.

Derek Parnell derek at psych.ward
Wed Sep 12 15:01:52 PDT 2007


On Wed, 12 Sep 2007 17:55:27 +0200, Downs wrote:

> There is two questions I want to ask:
> First, if you were starting a new language, should the behavior of
> continue in that language match what I expected in this case?
> (theoretical case)

Yes.

> And second, should the behavior be changed in the D programming
> language, even though it _might_ conceivably break code that relies on
> the current behavior? (practical case)

No.

However, if the introduction of scoped-labels is made, this becomes a
simple goto issue.

    do
    {
     @top:
     . . .
     if (whatever) goto @top;
     . . .
    } while( some_condition);

    do
    {
     @top:
     . . .
     if (anothertest) goto @top;
     . . .
    } while( some_other_condition);

At the moment, the scope of labels is too large and you have to invent new
label identifiers for each block scope.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list