develooper Front page | perl.perl6.language | Postings from March 2005

Carp in perl 6

From:
Thomas Yandell
Date:
March 14, 2005 00:49
Subject:
Carp in perl 6
Message ID:
e7ee6fd40503131606761fc31b@mail.gmail.com
Will there be a way to achieve what the Carp module does in perl 6? I
like the functionality it gives me, but think that it should be
builtin. Perhaps it could work like this:

  caller.throw('an error');

Could this:

  throw('an error');

just be another way to say:

  $?BLOCK.throw('an error');

?

The mechanism Carp has for throwing exceptions from further down the
call stack seems a bit clunky. The above would mean we could do:

  (caller Method, :skip(2)).throw('an error');

and possibly

  # use a closure to search back through the call stack
  throw_from({.package !~ $OUTER::?package}, 'an error');

Does this make any sense? Apologies if any of this has been discussed before.

Tom



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About