Proposal : allocations made easier with non nullable types.
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Mon Feb 9 06:39:20 PST 2009
Daniel Keep wrote:
> One option is the "turn everything into an expression" route. This is
> what Nemerle (think a functional superset of C#) did, and it's just
> BEAUTIFULLY expressive.
>
>> X x = if( someCondition ) new SomeX(); else new SomeOtherX();
>
> Failing that, there's always this (note: didn't do a syntax check on
> this :P):
>
>> X x = ({if(someCondition)
>> return new SomeX();
>> else return new SomeOtherX();})();
>
> Or something to that effect.
Like this?
X x = (someCondition) ? new SomeX() : new SomeOtherX();
*Much* preferred to delegate trickery, I'd think...
More information about the Digitalmars-d
mailing list