Feedback Thread: DIP 1043--Shortened Method Syntax--Final Review

Dukc ajieskola at gmail.com
Sat Jun 18 15:21:23 UTC 2022


On Wednesday, 15 June 2022 at 09:21:58 UTC, Mike Parker wrote:
> This is the feedback thread for the Final Review of DIP 1043, 
> "Shortened Method Syntax".

This DIP allows function templates, for example
```D
auto sqr(T)(T x) if(isIntegral!T) => x*x;
```
. But to arrive at that conclusion, one has to check the language 
grammar spec, seeing what kind of declarations use 
`FunctionBody`. I think an explicit mention is better. Just a 
slight mention is enough IMO, no need for exploration of what 
that enables.

The examples in "brevity" curiously have five spaces added before 
the member field of the structs. It's a little unconventional. Is 
this the intention?

"but there will be fewer keystrokes by virtue of there being no 
braces": in fact it's the omission of `return` that is the 
primary character saver. Omission of braces saves theoretically 
no characters ("{}" vs "=>"). In practice it usually saves one 
character because there is one operator less, so one less of the 
spaces most add between the operators.


More information about the Digitalmars-d mailing list