Spec#, nullables and more

retard re at tard.com.invalid
Sat Nov 6 04:52:04 PDT 2010


Sat, 06 Nov 2010 10:20:24 +0100, Simen kjaeraas wrote:

> Walter Bright <newshound2 at digitalmars.com> wrote:
> 
>> Consider non-nullable type T:
>>
>>    T[] a = new T[4];
> 
> As others have pointed out, this would be impossible for a proper
> non-nullable type. The only ways to create an array of non-nullable
> elements would be a literal, concatenation with non-nullable elements,
> or casting an existing array of nullable elements.

That's bs.. the functional way to doing this is to wrap all elements in a 
Maybe monad. It makes the "null check" explicit.


More information about the Digitalmars-d mailing list