On Thu, Apr 12, 2001 at 10:47:55PM +0200, Abigail wrote: > Deprecating to me means, there's an advantage to remove it from the > language. I fail to see what the advantage would be. Do you have a better > of what 'sub foo {last}' could do? Would it make the implementation > faster? This isn't about faster, its about action at a distance. This feature doesn't have any use but for implementing action at a distance. Its sort of like a reverse goto LABEL. Basically, you're calling a subroutine that alters the control flow of its caller. There's very, very, very few legit things that are allowed to do this in Perl. One is goto LABEL and its dubious at best. But at least goto has to go to a declared LABEL. die() inside an eval BLOCK can sort of be seen to do something similar, but its obvious you're expecting it (since you used an eval BLOCK). Finally, there's exit() which is not recommended to use in a subroutine or module. Essentially, consider the following... while(1) { foo(); } When will that exit normally (ie. not via a die or exit)? This should be a simple answer, but you can't know without examining foo() and all routines foo() might call. This is bad. All of the above (exit, die... maybe goto) have reasons for causing this caveat. last() really doesn't. *especially* because it can act without a LABEL. Its simple enough to get around. Simply set a global flag... sub foo { $Exit_Loop = 1 } while (1) { foo(); last if $Exit_Loop; } Now at least its clearer how loop control will go. -- Michael G. Schwern <schwern@pobox.com> http://www.pobox.com/~schwern/ Perl6 Quality Assurance <perl-qa@perl.org> Kwalitee Is Job One Any sufficiently encapsulated hack is no longer a hack. ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe