JuliaIO / Formatting.jl

Deprecated. See README. (A Julia package to provide Python-like formatting support)
Other
130 stars 23 forks source link

[FR] fprintf1() #91

Open gustaphe opened 3 years ago

gustaphe commented 3 years ago

I like sprintf1() as a dynamy/performance compromise for @printf, but it's not a drop-in replacement.

When working in a print-ecosystem, you end up doing things like print(io,sprintf(frmt,x)), which unnecessarily generates a string. I don't know the best way to implement a fprintf1 function without reusing a lot of code, but from what I've seen the most common way to do this kind of thing is to have fprintf be the base function, have sprintf use fprintf on an IOBuffer to generate the string.

Is there a strong reason to not do this?