On Wed, Nov 23, 2005 at 12:07:08PM -0500, Rob Kinyon wrote:
: On 11/23/05, Flavio S. Glock <[EMAIL PROTECTED]> wrote:
: > OTOH, it would be nice if
: >
: >   say substr( ~(1..Inf), 0, 10 )
: >
: > printed "1 2 3 4 5".

: This would work, I think, if ranges were convertable to iterators,

Range objects are supposed to *be* iterators, but pugs isn't there yet,
last I checked.

: stringification was lazy, and substr() informed the stringification of
: how much it needed to do. I'm not sure how feasible that last one is
: ...

I think the last one is more feasible than the middle one, at least
by default.  The problem is that stringification is considered a result
of a kind of scalar context, and ordinary scalar context is not lazy
in Perl 6.  So we'd probably need to set up some way of declaring
"this particular string is lazy".

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.


Reply via email to