On Saturday, 16 June 2018 at 18:49:43 UTC, Steven Schveighoffer wrote:
On 6/15/18 8:53 PM, Seb wrote:
On Saturday, 16 June 2018 at 00:32:24 UTC, H. S. Teoh wrote:
On Sat, Jun 16, 2018 at 12:20:35AM +0000, Seb via Digitalmars-d wrote:
On Friday, 15 June 2018 at 23:04:40 UTC, Sjoerd Nijboer wrote: > For someone coming from a C# background there is some > > seemingly
simple syntactic sugar missing from D.
> > * The null conditional operator `?.`

e.g. SafeAccess

https://github.com/BBasile/iz/blob/7336525992cb178ead83a7893a5a54597d840441/import/iz/sugar.d#L1551


Didn't Andrei propose an Elvis operator some time ago? Whatever became of that DIP?


T

https://forum.dlang.org/post/ot1q8b$23pt$1...@digitalmars.com
https://github.com/dlang/dmd/pull/7242

I think Razvan focused on other projects no one else bothered enough to write a DIP about this.

I don't know if this is the same thing. I'm not a (recent) C# developer, but in Swift, ?. means something completely different from ?: in Andrei's proposal.

-Steve

Yes, Andrei's proposal was for the equivalent of ?? in C#.

int* p = null;
int n = p ?: 42;
assert(n == 42);

Reply via email to