Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

S6 question: Is C<call> REQUIRED for a wrapper?

2 views
Skip to first unread message

Austin Hastings

unread,
Apr 11, 2003, 1:50:20 PM4/11/03
to perl6-l...@perl.org
[quote source="S6"]
Wrapping

Every subroutine has a .wrap method. This method expects a single
argument consisting of a block, closure or subroutine. That argument
must contain a call to the special call function:
[/quote]

"Must"?

Or, "should"?

That is, can I say:

sub shaddap()
{
&print.wrap { 1; } # No printing right now.
}

and have it work, or will this (by virtue of not referencing "call")
fail due to some sort of "Block supplied where Wrap expected" type
checking error?

=Austin

Larry Wall

unread,
Apr 11, 2003, 1:58:37 PM4/11/03
to perl6-l...@perl.org
On Fri, Apr 11, 2003 at 10:50:20AM -0700, Austin Hastings wrote:
: [quote source="S6"]

: Wrapping
:
: Every subroutine has a .wrap method. This method expects a single
: argument consisting of a block, closure or subroutine. That argument
: must contain a call to the special call function:
: [/quote]
:
: "Must"?
:
: Or, "should"?

"Should" is more like it.

: That is, can I say:


:
: sub shaddap()
: {
: &print.wrap { 1; } # No printing right now.
: }
:
: and have it work, or will this (by virtue of not referencing "call")
: fail due to some sort of "Block supplied where Wrap expected" type
: checking error?

It's probably worth a warning if you supply a wrapper that doesn't
wrap, but it's also probably worthwhile to be able to turn the
warning off.

Larry

0 new messages