
16 Nov
2004
16 Nov
'04
6:50 a.m.
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