On Tuesday, 10 December 2013 at 19:26:27 UTC, Andrei Alexandrescu wrote:
On 12/10/13 10:59 AM, monarch_dodra wrote:
On Tuesday, 10 December 2013 at 17:28:26 UTC, Andrei Alexandrescu
wrote:
We have only(x) (http://dlang.org/phobos/std_range.html#.only) to be a collection of exactly one value, but not a type for "a value of type T
or nothing at all"

Option is being upgraded to handle an arbitrary (but compile time
known) amount of values:
https://github.com/D-Programming-Language/phobos/pull/1743

Interesting! There is the problem one can't represent "no element of type T" and "one element of type T" with the same type.


Objects can do it pretty well. They even segfault to when you forgot about it. in D that feature is integrated !

Reply via email to