D community's view on syntactic sugar

Sjoerd Nijboer sjoerdnijboer at gmail.com
Fri Jun 15 23:04:40 UTC 2018


For someone coming from a C# background there is some seemingly 
simple syntactic sugar missing from D.

* The null conditional operator `?.`
* Something like a `yield return` statement for coroutines.
T* he `async` & `await` keyword from C# make proactor pattern 
async code extremely easy to reason about.
* a good syntax for properties so there's less code bloat.
* replacing `Allocator.make()` with `new!Allocator`. After all 
`new` can be concidered as just a wrapper around the standard GC 
allocator. Why can't we just have a special template of it?

I have realized that I have become quite dependant on syntactic 
sugar to the point that it severely impacts my productivity when 
I work whitout. And these ones are my biggest obstacles when I 
try to work with D from a C# experience. I think that C# really 
nailed down some of these particular examples except the last one 
of course.
And I also think D could do a better job of embracing 
productivity through supporting syntax of common tasks and borrow 
from other languages in that regard.

But the most important question is how other people feel about 
that.
If people hate syntactic sugar D will never become that gem for 
me that I would like it to be. But if key people want it, it one 
day might.


More information about the Digitalmars-d mailing list