Fix #417
This is my attempt to fix tracef for the wasm3 runtime. Looks convoluted, and it is, but it's just that implementing this portably is a PITA.
Also see #599
That one is simpler, but doesn't allow formatting (%08d). Also, it seems to emit a newline at the end, that's bad. tracef should behave like printf. Otherwise there's no way to emit a partial line, and that's quite useful.
It behaves in both of those ways to be identical to the web runtime.
In that case, the web runtime is seriously broken. There must be some way to emit a single character to the console without a newline.
I personally don't see this is a big issue since you are quite literally able to format the string and shouldn't need multiple calls to it. What is the use-case here that you feel this strongly about?
More technically, web browsers can't print single characters to the log, so you'd have to buffer it. If doing it that way, aside from breaking all current games using tracef, it's arguably also unintuitive to new users when nothing comes out in the console at all if they forget the newline.
I personally don't see this is a big issue since you are quite literally able to format the string and shouldn't need multiple calls to it. What is the use-case here that you feel this strongly about?
The use case I feel strongly about this, is that when experimenting with creating toy Langs, it puts some unecessary difficulty/annoyance on debugging stuff, as you would have to implement an string buffer first to have an clearer debug experience. But this is not a common thing to need, so i know it's not that important :p
It's important to me because that's exactly my use case, a toy language.
How about having a SYSTEM_STANDARD_TRACING to opt-in for this behaviour in the wasm3 runtime?