4 ms·
C++ I/O libraries in fact depend on the sequencing semantics built into the language. If we make two calls to the library, they happen in that order; consequent
by kazinator 10y ago
C++ I/O libraries in fact depend on the sequencing semantics built into the language. If we make two calls to the library, they happen in that order; consequently, the I/O happens in that order. We can do wrong things like:
f(cout << x, cout << y)
where we don't know whether x is sent to cout first or y.
C++ statements could be added to C++ (e.g. as a compiler extension). They would be straightforward to use; C++ doesn't inherently reject that the way Haskell and its ilk reject sequencing and state.
- bbcbasic 10y agoHaskell doesn't reject sequencing. f = g . h will require h is evaluated first.
- tome 10y agoh might not be evaluated at all! Consider h x = factorial x g x = 0 (but I agree that Haskell doesn't reject sequencing).
- deleted 10y ago[deleted]
- bbcbasic 10y agoYeah the IO monad will, but it isn't generally true of monads. Infant the maybe monad Will cease early on Nothing by design. So it is a brain shift.