DIP 1043---Shortened Method Syntax---Accepted
Timon Gehr
timon.gehr at gmx.ch
Wed Sep 21 12:59:11 UTC 2022
On 21.09.22 12:39, Mike Parker wrote:
> DIP 1043, "Shortened Method Syntax", has been accepted.
>
> The fact that the feature was already implemented behind a preview
> switch carried weight with Atila. He noted that, if not for that, he
> wasn't sure where he would stand on adding the feature, but he could see
> no reason to reject it now.
>
> Walter accepted with a suggested (not a required) enhancement:
>
>> It could be even shorter. For functions with no arguments, the ()
>> could be
> omitted, because the => token will still make it unambiguous.
>>
>> For example:
>>
>> T front() => from;
>>
>> becomes:
>>
>> T front => from;
>
> As DIP author, Max decided against this. He said it's not a bad idea,
> but it's then "inconsistent with other the other syntaxes". If there is
> a demand for this, it would be easy to add later, but he felt it's
> better to keep things simple for now by going with the current
> implementation as is.
🎉
Great news! :)
More information about the Digitalmars-d-announce
mailing list