thinking about the "latestring" and imagining that a "late printf"
would also be useful.
The general case would use closures instead of references, which
means writing an anon sub in the tie. Something like
package late;
sub TIESCALAR {
bless $_[1]
}
sub FETCH {
&$_[0]
}
__END__
the latestring example would become, in this different syntax,
tie my $s => late => sub { "x is $x and y is $y" };
and the closure mechanism takes care of tracking array references.
Sprintf function (or anything else) would jsut go into the sub.
tie my $h => late => sub {sprintf "x is %h and y is %h", $x,$y};
Is that preferable to
tie my $h => late::sprintf,"x is %h and y is %h", $x,$y;
the idea having been, a series of late::something modules that
all do a useful core function like sprintf or join('',...) and
the late module which would be the general one.
Thoughts?
--
david nicol
The elves have left the building