On Mon, Jan 29, 2007 at 02:06:51PM -0800, [EMAIL PROTECTED] wrote:
> +The C<take> function essentially has two contexts simultaneously, the
> +context in which the gather is operating, and the context in which the
> +C<take> is operating.  These need not be identical contexts, since they
> +may bind or coerce the resulting captures differently:
> +
> +    my @y;
> +    @x = gather for 1..2 {          # @() context for list of captures
> +        my $x = take $_, $_ * 10;   # $() context for individual capture
> +        push @y, $x;
> +    }
> +    # @x returns 1,10,2,20
> +    # @y returns [1,10],[2,20]

    XXX = gather {
        YYY
        take f();
        ZZZ
    }

    sub f () {
        return want.Scalar ?? 42 !! 54;
    }

Which of XXX, YYY, and ZZZ influence whether the taken value is 42 or
54? Please confirm there's *no way* that &f is entered twice here :-)

(If I'm following correctly, then take's args are basically evaluated
in list context. If YYY is something like "$scalar = " that list gets
Captured, but there's still a list there.)

-- 
Gaal Yahas <[EMAIL PROTECTED]>
http://gaal.livejournal.com/

Reply via email to