On Mon, Jul 07, 2008 at 10:09:37PM -0700, Larry Wall wrote:
: So
: 
:     $x = nothing();           # = []
:     @x = nothing();           # = ()
:     %x = nothing();           # = ()
:     if nothing() {...}                # always false
:     $x = nothing()[0]         # "Subscript out of range" failure

But note that binding the returned capture also fails:

    $x := nothing();

just as calling foo() without args can't bind to a sig with required
params:

    sub foo ($x) {...}

Binding to $x is more like looking for .[0], in other words.

Note however that when you call

    foo(nothing())

you're really passing a Capture with 1 positional element, which
contains the empty Capture returned by nothing(), so $x is presumably
bound to [] by promotion of the empty list, just as

    foo(threeitems())

would bind an array of 3 elements.

Larry

Reply via email to