On Wed, Mar 16, 2005 at 08:46:03PM +0800, Autrijus Tang wrote:
: Just a quick question.  In Pugs t/op/arith.t we have:
:     sub tryeq_sloppy ($lhs, $rhs, ?$todo1 = '') {
:       ...
:       ok($lhs==$rhs,$ todo);
:       ...
:     }
: But it breaks the $?CALLER based error reporting, because
: it introduces another layer of caller.
: In Perl5, I'd do this:
:     { local @_ = ($lhs == $rhs, $todo); goto &ok; }
: Does that form still work with Perl 6?

We will have some equivalent way to do an explicit substituting
tail call, but perhaps not with that syntax, since passing @_ through
is kind of bogus these days.  Probably we end up with


or some such.

: Or should I use this?
:     { local &_ := &ok; call($lhs == $rhs, $todo); }
: However, I did not see A/E/S06 specifying that call() will assume the
: &goto semantic of erasing itself from the caller chain, so I hesitate
: to implement it that way.

call() doesn't erase itself from the call chain, but it does "cloak"
itself so that CALLER doesn't see it by default.  (Presumably there's
an option to caller() that makes hidden frames visible.)  The whole
point of wrappers is that the aren't realy there in some logical sense.

: Is using wrap/call the correct choice here, or is there another way
: to do it that I missed?

wrap/call should do what you want there, but if you want to hack in
&func.goto, that'd be good too.


Reply via email to