Hacker News new | past | comments | ask | show | jobs | submit login

You use the default empty value, and have an extra field for missingness. Than you have real type safety.



Real type safety is sum types. If I need to express something that is present or missing, I should use a Maybe monad.

Having an extra field for "missingness" is less safe because the type system won't enforce that it is either missing or set, you could have it set to a value but marked as missing which is still ambiguous.


That's a "cure" worse than the disease.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: