Proposing std.typecons : Optional (with PR) + rant
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Tue Jun 11 19:02:12 UTC 2019
On Tuesday, 11 June 2019 at 18:01:32 UTC, Nick Treleaven wrote:
> I'd actually rather have language-assisted optional types than
> features like function overloading (a convenience feature,
> sometimes abused), because it means *the type system can model
> runtime checks as a static type guarantee*. They are a game
> changer.
I don't disagree, but one often end up creating a Nobody subclass
singleton that is used as a replacement for null. Although that
does have benefits (e.g. if you call a nobody.name() you get
"nobody" rather than a crash).
More information about the Digitalmars-d
mailing list