by puffybuf · 1y ago · 0 comments
An admirable statement of policy, but I'm not sure it's possible. Adding complexity to the language means there are more gotchas and edge-cases that a programmer must consider, even if they don't use the feature in question.
I like this feature as string formatting is something frequently used and this certainly looks cleaner and quicker to write.
Since this is C++, this is not a problem we have to consider
Rusts string formatting machinery does not require any heap allocations at all, you can for example impl fmt::Write for a struct that writes directly to a serial console byte-by-byte with no allocations, and then you have access to all of rusts string formatting features available to print over a serial console!
I'm not sure about the horrifying and dangerous extensions part though, I'm not really a C++ expert so I don't know if there's a better way to do what they want to do.
Formatting on the foreground thread would be a non-starter.
fmt library can also do something similar, but still requires the complexity of adding the library and passing arguments.