Discussion Thread: DIP 1043--Shortened Method Syntax--Community Review Round 1
bauss
jj_1337 at live.dk
Wed Feb 9 07:54:20 UTC 2022
On Tuesday, 8 February 2022 at 17:11:19 UTC, Adam D Ruppe wrote:
> On Tuesday, 8 February 2022 at 17:03:25 UTC, Doigt wrote:
>> you'll see exactly that they also have a case for lambda
>> expressions with no return values
>
> Which example is that? Do they assign it to a value of a
> different type?
>
I think the whole argument is that this will work in C#:
```d
int Value
{
get => _value;
set => _value = value; // This is okay
}
```
But it won't work in D according to this DIP:
```d
int value() => _value;
void value(int newValue) => _value = newValue; // This will not
work
```
So instead everything becomes inconsistent like:
```d
int value() => _value;
void value(int newValue) { _value = newValue; } // This is ok obv.
```
However, now the code looks inconsistent and not intuitive at all.
More information about the Digitalmars-d
mailing list