3 ms·
I think Go's log package, and similar, have the best take on this: log.Print(fixed_string) log.Printf(format_string, args...) Simple, unambiguous.
by ericbarrett 5y ago
I think Go's log package, and similar, have the best take on this:
log.Print(fixed_string)
log.Printf(format_string, args...)
Simple, unambiguous.
- skybrian 5y agoWell, almost. If you change Print with one argument to Printf, the compiler doesn’t complain. Maybe lint or vet will warn about it. If it were a special type then the compiler could do it.
- rixed 5y agoJust for the record, it is possible to type check format strings with regard to their actual arguments. OCaml does this, for instance, probably since its inception ~30 years ago or so.