ideas about ranges

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri May 22 18:47:46 PDT 2009


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



More information about the Digitalmars-d mailing list