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.

There's also the unrelated issue that the result of the proposed only() is passed around by value, even after it has been partially discarded.


Andrei

Reply via email to