[OT] C# 6.0 ?. null propagation operator

Daniel N via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 20 13:48:35 PDT 2015


On Monday, 20 April 2015 at 14:19:06 UTC, Meta wrote:
> On Monday, 20 April 2015 at 08:24:08 UTC, weaselcat wrote:
>> http://www.reddit.com/r/programming/comments/335b1s/the_new_operator_in_c_6/
>>
>> of interesting note was the nim sample on how to implement the 
>> same thing in nim in 2 lines of code
>>
>> template `?.`(a, b): expr =
>>  if a != nil: a.b else: nil
>>
>> template `??`(a, b): expr =
>>  if a != nil: a else: b
>
> HS Teoh came up with a beautiful solution using opDispatch, but 
> I can't find the thread right now. That also reminds me that I 
> meant to make a PR for it and completely forgot.

http://forum.dlang.org/thread/lnsc0c$1sip$1@digitalmars.com?page=6#post-mailman.2584.1403213951.2907.digitalmars-d:40puremagic.com


More information about the Digitalmars-d mailing list