Skip Menu |

This queue is for tickets about the Scalar-Lazy CPAN distribution.

Report information
The Basics
Id: 55671
Status: open
Priority: 0/
Queue: Scalar-Lazy

People
Owner: Nobody in particular
Requestors: cpan.pavel [...] kudinov.name
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.03
Fixed in: (no value)



Subject: lazy { } 'init' is not lazy
use Scalar::Lazy; $\="\n"; my $var = lazy { print 'call'; 'val' } 'init'; print 'code'; print $var; print $var; # without 'init': code call val call val # with 'init' it's not lazy at all and print: call code val val # instead of expected: code call val val
Срд Мар 17 16:52:13 2010, KUDINOV писал: Show quoted text
> use Scalar::Lazy; > $\="\n"; > my $var = lazy { print 'call'; 'val' } 'init'; > print 'code'; > print $var; > print $var; > > # without 'init': > code > call > val > call > val > > # with 'init' it's not lazy at all and print: > call > code > val > val > > # instead of expected: > code > call > val > val
p.s. IMHO there's should be short macro for lazy { } 'init', because this mode is expected by default (call on first read -> store result into internal cache -> fetch from cache on further reads)