in reply to goto with some arguments

I'd normally write that using an exception. Exception::Class is a particularly nice way to get where you're going with that.

use Exception::Class ( SomethingException => { fields => [qw/error_code error_msg/] }, ); .... much later if ($this_is_not_right) { SomethingException->throw( error_code => 123, error_msg => 'this is error' ); }

Seeking Green geeks in Minnesota

Replies are listed 'Best First'.
Re: Re: goto with some arguments
by pg (Canon) on Mar 17, 2003 at 03:41 UTC
    Thank you, and this is definitely the most ideal, and future direction, although a distribution table is also not a bad idea.

    One might argue that there are cases, the usage of goto is beautiful, but:
    1. once you use it, the chance you will abuse it is increased.
    2. it is mathematically proved that, goto is not needed. Any control flow involves goto, can be rewritten without goto.
      I definitely agree with the first point, but I think it's peculiar we're saying "mathematically ... is not needed" in a forum where Perl is the topic. There are a lot of things in Perl that we don't need, (unless is the first example that jumps in my mind). I think that not needed linguistic structures are here to increase expressiveness.
      > 2. it is mathematically proved that, goto is not needed.
      > Any control flow involves goto, can be rewritten without goto.
      That's a bit stretched. I mean if the equivalence is the Turing equivalence than you can program with lambda expressionas or POST systems, but when you take into account time complexity, or space complexity and you take into account O(1) differencees then it's not quite like this.

        2. it is mathematically proved that, goto is not needed. Any control flow involves goto, can be rewritten without goto.

      "Beware the Turing tar-pit in which everything is possible but nothing of interest is easy." - Perlis, Alan J.: ``Epigramms on Programming'' SIGPLAN Notices, sept (1982), 7-13