On Wed, Dec 3, 2008 at 3:05 PM, Patrick R. Michaud <[EMAIL PROTECTED]> wrote:
>> It does seem like a closure trait sort of thing, but I don't think
>> it's currently provided by the p6 spec.
>
> Perhaps PRE ... ?

Isn't  PRE { blah; } just short for ENTER { die unless blah; } ?

It still has the problem that it won't get executed if the loop body never is.

>
>    while (someCondition()) {
>        PRE { doSomething(); }
>        doSomethingElse();
>    }

Might never call doSomething().

> Or, if you wanted to be sure that doSomething() is always called
> at least once:
>
>    repeat {
>        PRE { doSomething(); }
>        doSomethingElse();
>    } while someCondition();

Calls doSomethingElse() even if someCondition() is initially false
(violates the "gotcha" I mentioned).

Incidentally, I was just trying to clarify what I think Aristotle was
asking for, and am not saying it's needed. I suspect this might be too
specific a case to worry about, and I'm willing to settle for the
solution in my last message (using an if inside a do or loop block).

-- 
Mark J. Reed <[EMAIL PROTECTED]>

Reply via email to