Remus

Namespace rswhite4 at googlemail.com
Wed Oct 10 00:10:07 PDT 2012


On Wednesday, 10 October 2012 at 07:06:54 UTC, Jacob Carlborg 
wrote:
> On 2012-10-09 21:10, Namespace wrote:
>
>> My next version will contain the elvis operator:
>> [code]
>> Foo obj = otherObj.get() ?: null;
>> if otherObj.get() is _not_ null, it will assign to obj, 
>> otherwise obj
>> will be assigned with null.
>> [/code]
>
> Will it support this syntax:
>
> Foo obj;
> obj ?= otherObj.get();
>
> Will only assign to "obj" if it's null.

You mean:
[code]
Foo obj;
if (obj is null) {
     obj = otherObj.get();
}
[/code]
?

Interesting point. Until now this isn't supported but I will 
think about it.


More information about the Digitalmars-d-announce mailing list