NAME

FP::TransparentLazy - lazy evaluation with transparent evaluation

SYNOPSIS

use FP::TransparentLazy;

my $a = lazy { 1 / 0 };
print $a # -> Illegal 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 even more EXPERIMENTAL than the remainder of the FP project. 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

FP::Lazy