ideas about ranges
Daniel Keep
daniel.keep.lists at gmail.com
Sat May 23 07:00:08 PDT 2009
Andrei Alexandrescu wrote:
> Rainer Deyke wrote:
>> Jason House wrote:
>>> Do you have any common cases where a range would generate nulls as
>>> part of its normal output? I think using the natural null feature of
>>> reference types is a clean and reasonable solution.
>>
>> Iterating over an array that contains nulls?
>>
>> Nullable!(T) must be able to hold all values of T, plus null. By
>> inference, Nullable!(Nullable!(T)) must be able to hold all values of T,
>> plus two different null values. 'Maybe' in Haskell can do this. (The
>> two null values are called 'Nothing' and 'Just Nothing'.)
>> 'boost::optional' in C++ can do this.
>
> They can't store a nullable ref int. They'd have to store a nullable
> pointer to an int. Then wait, there exists a null pointer to an int.
>
> Andrei
The way C# solves this is to have IsSet and Get properties or something.
More information about the Digitalmars-d
mailing list