News for hackers. Stuff that matters.
Re:The Logical Disaster of Null by paulddraper on Wednesday May 09, 2018 @09:53PM (#17035875)
Correct. The real evil is sentinel values.

That said, the memory layout of Maybe/Optional (assuming it can be stack allocated) will look much like what you outlined, though of course the API can be more user friendly.

Re:The Logical Disaster of Null by tathougies on Thursday May 10, 2018 @01:53AM (#17036686)
> That said, the memory layout of Maybe/Optional (assuming it can be stack allocated) will look much like what you outlined, though of course the API can be more user friendly.

But it's really not. First of all, most Haskell compilers will optimize away usages of Maybe that are known to be Nothing or Just. Secondly, GHC at least uses tagged pointers for small sum types, including Maybe.

Re:The Logical Disaster of Null by bjz_ on Thursday May 10, 2018 @05:18AM (#17037354)
Rust will do optimisation on the layout of Option-looking data types to simplify them down to a pointer size if possible.