Rod Adams skribis 2005-03-12 17:41 (-0600):
> Why not just rename C< sprintf > to C< format > and ditch printf and sayf?

Because format is almost as much typing as sprintf, and in many
circumstances needs both parens and quotes:

    format("%03d %15s", $foo, $bar), $baz, ...

compared to

    f/%03d %15s/$foo, $bar/, $baz, ...

> I will also remind you of the Scalar C< .as() >  method, which sprintf's 
> it's value.
>    print "$foo.as('%03d') $bar.as('%15s')";

I like sprintf because with it, I can separate data from presentation.
When I interpolate, I want the things I'm interpolating to be as simple
and short as possible. "Hello, $name" looks natural. "Hello,
$person.name" looks a little less natural. Any .as(ugliness) makes it
impossible to read and leaves you with code-in-text, which as many
templating languages have already shown can very quickly get very ugly.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to