4 ms·
> than to make std::optional next to useless for it's stated case. This is such a ridiculous and obviously false assertion that it’s indistinguishable from sat
by CyberRabbi 6y ago
> than to make std::optional next to useless for it's stated case.
This is such a ridiculous and obviously false assertion that it’s indistinguishable from satire. Optional is widely used and was modeled from a pre-existing boost class which was itself widely used. Do you actually write C++ professionally?
- monocasa 6y agoYes. And I think (hope?) that std::optional is going to make it's way into the dust bins of history like auto_ptr. When the answer is "just don't deference it if it's null", then why not just use a pointer in the first place?
- CyberRabbi 6y agoAgain, optional is different from pointer because it offers value semantics.
- monocasa 6y agoI know they're different (and the construct unfortunately named optional has some occasional uses); it's just that the semantics of optional don't help it be used as a classic optional type.
- jcelerier 6y ago> it's just that the semantics of optional don't help it be used as a classic optional type. what do you mean "classic optional type"? boost.optional has worked like that for something like 20 years - it's been in C++ for longer than Maybe has been in Haskell.
- monocasa 6y agoIt's been in Standard ML since the 80s.
- tome 6y ago> it's been in C++ for longer than Maybe has been in Haskell. Tangentially, how did you conclude that? Haskell has around since 1990 but boost only since 1999, as far as I can tell. https://en.wikipedia.org/wiki/Haskell_(programming_language) https://en.wikipedia.org/wiki/Haskell_(programming_language) https://en.wikipedia.org/wiki/Boost_(C%2B%2B_libraries) https://en.wikipedia.org/wiki/Boost_(C%2B%2B_libraries)