Excuse my noobness, I really have no idea about any of the inner workings,
but am just concerned with a more elegant syntax of doing it.

How about something like:

if ($condition) {
pre;
always { # maybe "uncond" instead of always, or both -- "always" could
# mean 'ignore all conditions' and "uncond" could mean
# 'ignore the current block's condition
mid_section;
}
post;
}

Or maybe:

if ($condition) {
pre;
} is continued;

mid_section;

continue {
post;
}

A flaw I see in the latter though is that you could not use the "is
continued" trait inside of mid_section without confusing the parser.

On 9/20/05, Yuval Kogman <[EMAIL PROTECTED]> wrote:
>
> Today on #perl6 I complained about the fact that this is always
> inelegant:
>
> if ($condition) { pre }
>
> unconditional midsection;
>
> if ($condition) { post }
>
> Either you put the condition in a boolean var and check it twice, or
> you use a higher order function and give it three blocks, and the
> conditional. But no matter how much we try, it always feels too
> "manual".
>
> I asked for some ideas and together with Aankhen we converged on the
> following syntax:
>
> if ($condition) {
> pre;
> } uncond {
> middle;
> } cond {
> post;
> }
>
> s/uncond/<<pause regardless>>.pick/e;
> s/cond/<<resume again>>.pick/e;
>
> Some restrictions:
>
> The block structure must always be ternary - for other cases we
> already have enough control flow.
>
> The if is not the same if that can cuddle with else - it's either
> or.
>
> Does anybody have any comments, or synonyms for the control
> structure naming?
>
> BTW, I expect readability to be optimal with 1-2 lines of pre/post,
> and 1-5 lines of middle. Any observations?
>
> --
> () Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418 perl hacker &
> /\ kung foo master: /me groks YAML like the grasshopper: neeyah!!!!!!
>
>
>
>

Reply via email to