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

&wrap, &call and goto &sub

Thread Next
Autrijus Tang
March 16, 2005 04:46
&wrap, &call and goto &sub
Message ID:
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?  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.

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

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About