On Wed, Nov 23, 2005 at 08:35:09PM +0100, Juerd wrote:
: Larry Wall skribis 2005-11-23 11:16 (-0800):
: > Range objects are supposed to *be* iterators, but pugs isn't there yet,
: > last I checked.
: Is the associated sigil @ or $? Either way, there's a problem.

No, either way it does what you want.

: $foo can't flatten in list context, which .. does want, which would be
: inconsistent,

If you say

    $r = 1..10;

you are intentionally putting the range object in a place where you
have to explicitly iterate it, so in list context you'd have to say

    for =$r { say }

: but with @, it cannot be copied, because that flattens in
: list context, which is provided by assignment to another @-thing.

It only flattens notionally as * lazy, which means if you say

    @r = 1..10;
    @s = @r;

the iterator doesn't have to be evaluated, but just passed along as
part of the .specs to the next array, presumably with COW so the two
arrays can then have the appearance of having flattened the iterator.
But it's all * magic, not ** magic.


Reply via email to