just an idea (!! operator)

David Nadlinger see at klickverbot.at
Fri Jul 13 06:46:02 PDT 2012


On Friday, 13 July 2012 at 12:51:07 UTC, Jacob Carlborg wrote:
> On 2012-07-13 11:24, Jonas Drewsen wrote:
>> // a is null if user or address or street is null. No 
>> exception thrown.
>> auto a = user?.address?.street;
>
> But what would the static type of "a" be?

I don't think there is much doubt in this regard: the type that
you get when none of the »intermediates« evaluate to null, i.e.
typeof(street). Anything else doesn't make much sense in my
regard.

I guess that this operator is only really worth it in languages
where every type is nullable, though.

David


More information about the Digitalmars-d mailing list