Proposing std.typecons : Optional (with PR)

aliak something at something.com
Tue Jun 11 09:58:48 UTC 2019


On Tuesday, 11 June 2019 at 07:46:38 UTC, FeepingCreature wrote:
> Since my rfc regarding deprecating `alias get this` in Nullable 
> (see https://github.com/dlang/phobos/pull/7060 ) encountered no 
> meaningful criticism (as I'm tactfully choosing to interpret 
> the total absence of reaction), but somebody mentioned that a 
> new type may have more success, since it doesn't have to 
> justify itself in the same way as a change to existing 
> behavior, I present `Optional`: 
> https://github.com/dlang/phobos/pull/7065 .
>
> [...]

If we're going to put an optional type there, I would consider 
not copy pasting nullable as it has some other issues as well, 
and maybe nail the interface down properly? E.g. having an 
optional that's a range would be rather awesome. Have you looked 
at: https://code.dlang.org/packages/optional. It has a lot of 
other added features as well but those can be removed if they're 
too much.


More information about the Digitalmars-d mailing list