6 ms·
Continuation passing monads form the basis of a perfectly valid and usable software architecture and programming pattern. In the case of ostream and operator<<
by 1letterunixname 3y ago
Continuation passing monads form the basis of a perfectly valid and usable software architecture and programming pattern.
In the case of ostream and operator<<, this pattern reduces the number of intermediate objects that would otherwise be constructed.
If you object to iostream on religious or stylistic grounds, there's always fmt which is more like Go or Python string interpolation.[0]
0. https://fmt.dev https://fmt.dev
- rwbt 3y ago> If you object to iostream on religious or stylistic grounds, No I object to it on usability grounds. It took more than 30 years for the committee to admit it but C++ now has typesafe std::print/std::format finally, after admonishing programmers for using `printf` in C.
- gpderetta 3y agoC++ only acquired the capabilities to have a statically type safe format string only recently. Iostreams have a lot of issues, but overloading<< is a very minor one.
- hawski 3y agoBut it is achievable without operator overloading, isn't it? There is also a reason why format strings seem to be more popular among the crowd.
- gumby 3y agoStreams have numerous design problems (e.g. representation is managed by the stream, not the thing you’re printing) making the shift operator syntax the least of the problems.
- kccqzy 3y agoWhich part of operator<< involves continuations, let alone continuation passing monads?