Discussion Thread: DIP 1043--Shortened Method Syntax--Community Review Round 1

bauss jj_1337 at live.dk
Wed Feb 9 12:38:56 UTC 2022


On Wednesday, 9 February 2022 at 12:14:22 UTC, Max Samukha wrote:
> It would look better if it was marked as a property setter and 
> D handled property setters specially.
>

That's what it is. It's a property but @property is useless in D 
and you shouldn't use it, so maybe if @property actually worked 
in D then yeah I would agree.

But since @property doesn't really work and is somewhat obsolete 
then it should absolutely be supported to do the above regardless 
of whether it's a property or not.

And it also only looks wrong to you because you think of "N => N" 
being an expression only, BUT in this case it's not supposed to 
be an expression. It's supposed to be a shortened method syntax. 
So arguably any function statement should be valid after the "=>" 
and it indeed should be an "edge-case" for the "=>" operator.

void a() => b(); is valid in __all__ other languages that support 
it and thus it should be valid in D too, otherwise D again only 
gets a feature half-assed and falls behind everyone else.

Can we just for once in D not rely on being "hacky"?


More information about the Digitalmars-d mailing list