[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] awww, no fun :(



Michael G Schwern wrote:
> 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.

That's what throw (die) does in every language.
This remote last is really just specialized kind of throw/catch.
It has its usefulness. As Randal kinda showed, you use it for
writing custom loop controls, i.e. custom variants of last.
If you don't like the ability to last from somewhere to who
knows where else, then you shouldn't like the ability to die 
that way either.


> But at least goto has to go to a declared LABEL.

Come on, it's not like remote last is like a computed goto.


> 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).

Ah -- what's needed, then, is an adjustment of expectations, not
of Perl.


> Finally,
> there's exit() which is not recommended to use in a subroutine or
> module.

By whom?   Ridiculous.


>         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.

No badder than this, which has exactly the same issues:

      eval {
        while(1) {
            foo();
        }
      };


> All of the above (exit, die... maybe goto) have reasons for causing
> this caveat.  last() really doesn't.

Apparently it does.  Adjust your expectations.


-- 
John Porter

Any technology distinguishable from magic is insufficiently advanced.


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe