> > > It definitely is, since formats do things that can't be done in modules.
> >
> >Such as???
>
> Well, the easy binding of variables for later use. When one declares a
> format, variables in it are saved for later use without needing refs.
> Formats are sort of like a quote where the variables are referenced rather
> than interpolated when defined, with the values pulled (and possibly
> altered) when the quote is used.
What I'm planning to RFC is a simple format() built-in (probably in a pragma)
very similar to the form() subroutine described in:
I would envisage that the correct way to set up the kinds of
referenced-not-interpolated templates is by creating a subroutine or closure:
sub format1 {
format "> >>> [[[[[[[[[[[[[[[[[[[[[",
$bullet,
$text;
}
which you can then interpolate at need:
print format1;
Alternatively, one could make the format nicely parametric using higher-order
functions:
my $format2 =
format "> >>> [[[[[[[[[[[[[[[[[[[[[",
__, __;
and later:
print $format2->($magic_bullet, $special_text);
or partially fill it in:
my $format3 = $format2->($magic_bullet);
I'll get to work on the format RFC as soon as possible, so that you can
see what I mean.
> :) I promised Kirrily that I'd race you in the RFC count...
That's hardly fair on you: I can just pull any crazy idea out of my head
whereas *you* have to be able to implement yours! :-)
Damian