3 ms·
It's not necessary to be a functional language to have this feature, but in the past it has been the case that mostly functional languages are the ones that do.
by insulanus 8y ago
It's not necessary to be a functional language to have this feature, but in the past it has been the case that mostly functional languages are the ones that do.
The reason I think this happened, is that the language designers of languages like C had things like machine code generation at the top of their mind when writing the language, not abstractions.
Once decisions were made in that mindset, you start making things very difficult to add this without having edge cases.
Anyway, C++ finally has enough features to support this, and the committee will accept it into the standard soon-ish. (Mind you, of course you will still be able to do foolishness like:
std::cout << static_cast<TrustMeImPrintable>(0);
P.S. The feature you need to support this is to be able to pick the types our of the "format sting" (whatever type you use to represent that object), and run a check against the types of the arguments, at compile time.