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

Carp in perl 6

Thomas Yandell
March 14, 2005 00:49
Carp in perl 6
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About