[Haskell-cafe] Re: Pure Haskell Printf
Ben Rudiak-Gould
Benjamin.Rudiak-Gould at cl.cam.ac.uk
Tue Nov 16 06:50:16 EST 2004
Keean Schupke wrote:
> At the risk of getting off topic... the reason 'C' has printf is because
> it is not polymorphic. Printf is a hack to allow different types to be
> printed out, such that they did not need printInt, printFloat etc.
Many language have printf-like functions despite not satisfying this
criterion. Perl, Python, and Common Lisp are the three that come to mind.
I think the reason they have it is that it's useful in general to be able
to visually separate the string template from the expressions being
printed. Even (name++", your age is"++age++".") is pretty punctuation-heavy
for a template. (Plus, it has a bug in it, which would be much easier to
see in the printf syntax.)
-- Ben
More information about the Haskell-Cafe
mailing list