3 ms·
> For Option types to work well and not be an awkward footgun (like C++ std::optional), you also need sum types and pattern matching. It works fine if you don'
by masklinn 7y ago
> For Option types to work well and not be an awkward footgun (like C++ std::optional), you also need sum types and pattern matching.
It works fine if you don't have these, though there are more tradeoffs (less convenience / compile-time safety).
C++'s std::optional is footguny because it is not a type-safety feature, it's an optimisation feature (a stack allocated pointer, hence it having "a pointer interface").