That’s working as it should (although maybe not as expected
). The return value of Printf.format is nothing. It’s printing the values to stdout (no new lines, since there aren’t any in the Format string), and then the REPL is printing the results of the broadcasted format: a Vector of 2 nothings.
Example with return values suppressed, and a newline added for clarity:
julia> Printf.format.(Ref(stdout), Ref(Printf.Format("%.2f\n")), x);
0.64
0.06
I completely agree that there are possibly better/more ergonomic solutions, depending on the needs. But if a string literal cannot be used (preventing the use of the printf macros), then Printf.format seems like the best option for that case.