NAME
FP::TransparentLazy - lazy evaluation with transparent evaluation
SYNOPSIS
use FP::TransparentLazy;
my $a = lazy { 1 / 0 };
like((eval {
# $a's evaluation is forced here
print $a
} || $@), qr/division by zero/);
# etc., see SYNOPSIS in FP::Lazy but remove the `force` and `FORCE`
# calls
DESCRIPTION
This implements a variant of FP::Lazy that forces promises automatically upon access (and writes their result back to the place they are forced from, like FP::Lazy's `FORCE` does). Otherwise the two are fully interchangeable.
NOTE: this is EXPERIMENTAL. Also, should this be merged with Data::Thunk ?
The drawback of transparency might be more confusion, as it's not directly visible anymore (neither in the debugger nor the source code) what's lazy. Also, transparent forcing will be a bit more expensive CPU wise. Please give feedback about your experiences!
SEE ALSO
NOTE
This is alpha software! Read the status section in the package README or on the website.