On 11/23/05, Larry Wall <[EMAIL PROTECTED]> wrote:
> Basically, we're attaching the whole lazy/nonlazy mess to the
> list/scalar distincion, which I think is a really good default.
> We use ** and lazy() to violate those defaults.

I think you might be mixing up the "scope" of laziness here.  Having a
lazy string to me is much like:

    my @a = 1...;
    my $b = [EMAIL PROTECTED];

Scalar context is strict, but that doesn't necessitate strict
evaluation the whole way down.  The scalar context in that example is
saying "evaluate the reference *now*", not the list.

The kind of lazy string that would be affected by scalar context is:

    my $str = do { say "hi there"; "foo" };
    say "intermediate";
    say $str;

If scalar context were lazy, it would say "hi there" *after*
"intermediate" (but before "foo", of course).

But we're talking about a string with a lazy internal representation,
like a reference to a lazy list.  That's perfectly okay to pass around
in scalar context.  And I think it's perfectly okay to have
stringification return this kind of lazy string.

Luke

Reply via email to