On Monday 22 August 2005 04:25 pm, Larry Wall wrote:
> On Tue, Aug 23, 2005 at 04:09:29AM +0800, Yiyi Hu wrote:
> [stuff]
> : Even if making scalar lazy might cause problem sometimes, Is it
> : possible to add a property which is like
> : my $var is lazy; to handle these situation?
>
> In Perl 6 you make lazy scalars by putting curlies around them:
>
>     my( $s, $t ); $s = { "value t is $t" }; $t = "xyz"; print $s();
>
> Currently we also require the de-lazifying context to supply a
> postfix .() marker, but possibly that could be assumed in a string
> or numeric context.
>
> I really don't see much benefit in making it easier than that.
>
Agreed, especially since it would be a sort of false laziness (sorry to 
confuse the term). It's easy to understand the rule that double quotes 
interpolate when they're evaluated, once you learn the rule. Something like 
the grandparent's "is lazy" would introduce a whole mess of rules regarding 
what gets evaluated when, and in what scope. But there already exists a set 
of such rules for curlies, and it only seems sane to use them rather than 
adding more complexity.

Reply via email to