On Wed, Feb 07, 2001 at 10:59:00PM -0600, David L. Nicol wrote:
> 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
> 
> How is 
> 
>       $flag=1
> 
> clearer than
> 
>       POST{close FOO;&dropLock}

I didn't give $flag a good name to explain what I was thinking:

POST is clearer if the POST{} action fits on 1 line
otherwise you end up with lots of clearup stuff visually in the way of the
regular flow of control (in my opinion)

stuff which feels like it belongs near the bit that returns.
hmm. or stuff that feels like it lives near the statement that it's
undoing.
I like both sides of the argument. I'll shut up.

> in this example?  I don't think the consistency issue is strong enough.

I do not think it is very strong, definitely not strong enough alone.

> We are also being inconsistent by not suggesting a PRE which would be
> analogous to BEGIN and would run at the beginning of a sub even though
> it is defined halfway into it. For interior blocks, a label would
> be used to say which block we're firing after.  Or we always use sub
> blocks and that's that.

Good point "We provide PRE for symmetry with with POST" sounds stupid
"We don't provide a PRE to go with POST because there's little practical
use for it" sounds sensible.

Nicholas Clark

Reply via email to