Thesh wrote:3fj wrote:That's certainly part of it. I've got more experience with C than with C++, so I'm biased towards the format specifiers way of doing things. That said, I still don't think it's beneficial to make the parsing of a string any more complex than it already is. If you have a function that you wish to run, I think it's more easily read when separated out from the string. And as I pointed out earlier, to me plaintext readability should be the minimum level that we're thinking about.
The main benefit is type safety; this is where C has its problems. That, and the lack of portability given that Windows and Linux use different format specifiers for 64-bit integers. If you are using a recent version of VIsual Studio, you finally have inttypes.h and stdint.h for cross-platform programming, but PRI* macros just look like they should be a syntax error: printf("%"PRId64"\n",x);
I still think you're undervaluing extensibility to user-defined types, and to get that with a remotely reasonable syntax you need either (1) templates (preferably either variadic templates or member templates) or (2) "abuse" of operator overloading.
At least to me, I really think there's no syntax you could propose that is better than << and >> enough that you'll get me to give up extensibility for it, short of implementing in the compiler either (1) mind reading or (2) magic, which means that looking through a historical lens, the design of iostreams was IMO by far the best possibility at the time it was created. Once templates were around, the question was not so much "can we do better than iostreams" but "are the alternatives to iostreams better enough to add a new mechanism".