On 22/09/05, Shane Calimlim <[EMAIL PROTECTED]> wrote:
> 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;
> }
That's quite elegant, but overloading `if` like that is completely
insane and unpredictable, because you can no longer assume that all
the code inside is tied to the conditional.
A more maintenance-programmer-friendly version might look more like this:
# doesn't really matter what it's called, so long as it's not `if`
sometimes $condition {
pre;
ALWAYS { body; } # caps help too
post;
}
Which is exactly the same, except that by using a different keyword,
we're telling the reader that the rules of `if` don't apply
here--there's going to be some unconditional code in the conditional
block. This way, `if` always means 'if', rather than 'if, except on a
Tuesday'.
Mind you, this sort of solution is probably implementable purely as a
module, so if people don't think it's useful enough to go in core then
those who do need it won't really miss out.
Stuart