D community's view on syntactic sugar
Kamil Koczurek
koczurekk at gmail.com
Wed Jun 20 21:44:12 UTC 2018
On Saturday, 16 June 2018 at 02:44:04 UTC, Jonathan M Davis wrote:
>> * The null conditional operator `?.`
>
> It's been discussed before, and maybe we'll get it or something
> like it at some point, but it really wouldn't help much with
> idiomatic D. The average D program does a _lot_ less with
> classes than a language like C# does. Most stuff is done with
> structs on the stack - especially with range-based programming.
> That's not to say that certain types of programs couldn't
> benefit from such syntax, but it's going to be a lot less
> common than it is with C#. But it's also pretty trivial to
> write a helper function that does the same thing if you really
> want a short-hand way to do it.
That's not the only use case. Recently I'm using Algebraic pretty
often and I really wish that this would work:
alg.peek!AThing?.method();
More information about the Digitalmars-d
mailing list