On Wed, 7 Feb 2001 23:41:32 +0000, Nicholas Clark wrote:
>[on the other hand, I'll argue the other side that
>
>{
> my $flag
> open FOO, "<bar" ? $flag=1 : die "aargh $!";
> ...
>}
>post {
> close FOO if $flag;
>}
>
>is clearer because the tidy up doesn't visually get in the way of the flow
>of what you're doing, and you can see what $flag is meant to be
Perhaps. Then where will you put the equivalent PRE block? To make some
sense WRT control flow, you should ut it upfront, BEFORE the declaration
of the sub which it'll work on. But, from a language syntax point of
view, that's nonsense. It's like putting the "else" before the "if".
Yes, there ought to be PRE blocks as well. This is pure a syntax thing,
the behaviour ought to be the same as so meticulously described by
Damian Conway.
The idea is inspired, not just by the existing BEGIN and END blocks
syntax, but also by the fact that in 5.6.0, you can put a sub definition
inside another sub. You can nest them. The effect is that nested sub is
only visible from within the outer sub. That seems rather appropriate
here.
--
Bart.