Next Version of Lua?

classic Classic list List threaded Threaded
143 messages Options
1 ... 5678
Reply | Threaded
Open this post in threaded view
|

Re: Next Version of Lua?

Henk Boom-2
2009/6/19 Hisham <[hidden email]>
> So I'm guessing that my personal "expected" behavior for
> continue-within-repeat would be Peter Cawley's alternative number 5:
>
> > 5) A "continue" within a repeat ... until construct causes execution
> > to jump back to the statement immediately following the "repeat", thus
> > skipping the "until" clause entirely.

Unfortunately this solution makes it hard to reason with loop
invariants, since you can no longer make the assumption that the loop
condition holds at the beginning of each iteration.

    Henk
Reply | Threaded
Open this post in threaded view
|

Re: Next Version of Lua?

Florian Weimer
* Henk Boom:

> 2009/6/19 Hisham <[hidden email]>
>> So I'm guessing that my personal "expected" behavior for
>> continue-within-repeat would be Peter Cawley's alternative number 5:
>>
>> > 5) A "continue" within a repeat ... until construct causes execution
>> > to jump back to the statement immediately following the "repeat", thus
>> > skipping the "until" clause entirely.
>
> Unfortunately this solution makes it hard to reason with loop
> invariants, since you can no longer make the assumption that the loop
> condition holds at the beginning of each iteration.

You can't do that for repeat ... until anyway. 8-)
Reply | Threaded
Open this post in threaded view
|

Re: Next Version of Lua?

Henk Boom-2
2009/6/20 Florian Weimer <[hidden email]>
* Henk Boom:

> 2009/6/19 Hisham <hisham.hm@gmail.com>
>> So I'm guessing that my personal "expected" behavior for
>> continue-within-repeat would be Peter Cawley's alternative number 5:
>>
>> > 5) A "continue" within a repeat ... until construct causes execution
>> > to jump back to the statement immediately following the "repeat", thus
>> > skipping the "until" clause entirely.
>
> Unfortunately this solution makes it hard to reason with loop
> invariants, since you can no longer make the assumption that the loop
> condition holds at the beginning of each iteration.

You can't do that for repeat ... until anyway. 8-)

Heh, you got me there =)

I think people are sort of used to handling the first iteration as a special case in repeat/until, though.

    Henk
1 ... 5678