develooper Front page | perl.perl5.porters | Postings from June 2011

Re: RFC: Make break last

Thread Previous
June 13, 2011 12:38
Re: RFC: Make break last
Message ID:
Johan Vromans wrote:
>Basically, 'break' is just like 'last' except that it can only be used
>in a 'given' block. 

If a given block contains a loop, then "break" exits the given block,
skipping past the loop.  Likewise for "last" where a loop contains a
given block.  There is some convenience in being able to target the
outer block without having to label it.

>I propose to make 'break' and 'last' the same.

I'd have been pretty neutral on this if you'd proposed it when given
was being first designed.  It's a reasonable variation in the space
of possible designs.  But at the present juncture it has the severe
disadvantage of being incompatible with the existing language feature.
We'd need another feature switch to distinguish between the two behaviours
of "break" and "last".  The benefit of the change would have to be
pretty large to outweigh the inconvenience and confusion that this
selectability would bring.  It is absolutely not worth the trouble for
such a marginal change.


Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About