in reply to How to untie oneself?
However it is possible to achieve the same effect by having your tie method accept an optional reference which will have the value stored, and then export utility methods that use it. So you might wind up with something like this interface:
and then you implement this along the following lines:promise(\ my $result_of_long_compute, sub { # Long computation here });
And then document that using the promise() utility function is faster than using the tie interface.sub promise { my ($to_tie, $implement, $opts); if (UNIVERSAL::isa($to_tie, 'SCALAR')) { tie $$to_tie, Data::Lazy, $implement, $opts; } elsif (UNIVERSAL::isa($to_tie, 'HASH')) { ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to untie oneself?
by Jenda (Abbot) on Jul 10, 2003 at 22:18 UTC | |
by tilly (Archbishop) on Jul 11, 2003 at 06:06 UTC |