[Rt-commit] r5581 - in Data-Defer: . lib/Scalar
audreyt at bestpractical.com
audreyt at bestpractical.com
Mon Jul 17 14:15:53 EDT 2006
Author: audreyt
Date: Mon Jul 17 14:15:52 2006
New Revision: 5581
Removed:
Data-Defer/lib/Data/
Modified:
Data-Defer/Changes
Data-Defer/README
Data-Defer/lib/Scalar/Defer.pm
Log:
* Renamed to Scalar::Defer
Modified: Data-Defer/Changes
==============================================================================
--- Data-Defer/Changes (original)
+++ Data-Defer/Changes Mon Jul 17 14:15:52 2006
@@ -1,7 +1,7 @@
[Changes for 0.02 - 2006-07-17]
-* Changed name from Data::Thunk to Data::Defer, per suggestion
- from mstrout++ and gaal++.
+* Changed name from Data::Thunk to Scalar::Defer, per suggestion
+ from obra++, mstrout++ and gaal++.
* The "thunk" function is gone; "lazy" is now the memoizing
variant of "defer".
Modified: Data-Defer/README
==============================================================================
--- Data-Defer/README (original)
+++ Data-Defer/README Mon Jul 17 14:15:52 2006
@@ -1,28 +1,28 @@
NAME
- Data::Thunk - Calculate values on demand
+ Scalar::Defer - Calculate values on demand
SYNOPSIS
- use Data::Thunk; # exports "lazy" and "thunk"
+ use Scalar::Defer; # exports 'defer' and 'lazy'
my ($x, $y);
- my $l = lazy { ++$x };
- my $t = thunk { ++$y };
+ my $dv = defer { ++$y }; # a defer-value (not memoized)
+ my $lv = lazy { ++$x }; # a lazy-value (memoized)
- print "$l $l $l"; # 1 2 3
- print "$t $t $t"; # 1 1 1
+ print "$dv $dv $dv"; # 1 2 3
+ print "$lv $lv $lv"; # 1 1 1
DESCRIPTION
- This module exports two functions, "lazy" and "thunk", for building
+ This module exports two functions, "defer" and "lazy", for building
values that are evaluated on demand.
- lazy {...}
+ defer {...}
Takes a block or a code reference, and returns an overloaded value. Each
time that value is demanded, the block is evaluated again to yield a
- fresh value.
+ fresh result.
- thunk {...}
- Like "lazy", except the value is computed at most once. Subsequent
- evaluation will simly use the cached value.
+ lazy {...}
+ Like "defer", except the value is computed at most once. Subsequent
+ evaluation will simly use the cached result.
NOTES
Unlike the "tie" based Data::Lazy, this module operates on *values*, not
Modified: Data-Defer/lib/Scalar/Defer.pm
==============================================================================
--- Data-Defer/lib/Scalar/Defer.pm (original)
+++ Data-Defer/lib/Scalar/Defer.pm Mon Jul 17 14:15:52 2006
@@ -1,5 +1,5 @@
-package Data::Defer;
-$Data::Defer::VERSION = '0.02';
+package Scalar::Defer;
+$Scalar::Defer::VERSION = '0.02';
use 5.006;
use strict;
@@ -41,11 +41,11 @@
=head1 NAME
-Data::Defer - Calculate values on demand
+Scalar::Defer - Calculate values on demand
=head1 SYNOPSIS
- use Data::Defer; # exports 'defer' and 'lazy'
+ use Scalar::Defer; # exports 'defer' and 'lazy'
my ($x, $y);
my $dv = defer { ++$y }; # a defer-value (not memoized)
More information about the Rt-commit
mailing list