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

welkam wwwelkam at gmail.com
Fri Jul 1 00:06:15 UTC 2022


On Tuesday, 28 June 2022 at 16:32:46 UTC, Timon Gehr wrote:
>> Go language is the way it is for valid reasons. Don't dismiss 
>> them easily.
>
> Why not? I dislike Go for valid reasons.

I dont like Go as a language as well but I can still recognize 
that simplicity and uniformity is a valuable thing. Now its 
crystal clear that I was unable to effectively communicate what I 
was thinking. The problem is that I dont know how else should I 
did it.

Google has a problem that they constantly are hiring new 
programmers and those programmers write code in their own way. 
Code bases written this way are not optimal. Go being the way it 
is makes its so that it easier to teach the language and its 
easier to onboard new programmer onto the project. I'm not going 
to list the negative trade offs of Go`s design decisions as I 
believe its obvious for people in this forum. On the other hand 
the benefits of Go or C designs seem to be valued at 0.

Discussions here revolved around question "do you want these 
benefits or not?" while it should have been "do you think the 
benefits are worth the tradeoffs?". Instead of talking about the 
best case scenario of one line functions in classes more time 
should have given to other possible uses and its effects on 
readability.

```d
auto bar() => iota(1, 100)
                     .map!(x => x + 1)
                     .filter!(x => x > 4)
                     .foo();
```

```d
auto bar = iota(1, 100)
                 .map!(x => x + 1)
                 .filter!(x => x > 4)
                 .foo();
```
Code like this is going to be written and I didnt saw discussions 
about it or any other potential reduction in scanability of a 
code as a result of the proposed changes.

Before starting to write in this thread I looked at how setters 
and getters are taught in C# as that language has implemented 
shorter syntax. 3 out of 3 videos did not feature this shorter 
syntax for one line functions. Any guesses as to why?


More information about the Digitalmars-d mailing list