Type Inference for Struct/Enum Literals

Nick Treleaven nick at geany.org
Sun Jul 7 19:07:10 UTC 2024


On Saturday, 6 July 2024 at 08:04:36 UTC, ryuukk_ wrote:
> The pushback is from people who never got to learn new 
> languages, they believe this is what everyone wants to write

They do not believe that.

The proposal is fine except where it breaks existing code. I 
don't think editions should redefine syntax without a very good 
reason. There is a limited budget for breakage per edition. (An 
example of such a reason is breaking bug-prone code).

> `MySelfExplanatoryType flag = MySelfExplanatoryType.A | 
> MySelfExplanatoryType.B MySelfExplanatoryType.C;`

You could write:
```d
auto flag = { with (MySelfExplanatoryType) return A | B | C; }();
```
> And when they tell you that "you can use an alias", it's when 
> you know they are being dishonest, the point is not to make

You don't know they are being dishonest (and its unhelpful to 
assume that).

It is valid (and necessary) when considering language changes to 
compare them against uses of existing features.

> things unreadable or obfuscated, it's to avoid repetition and 
> to make code more concise in places that are relevant

Do you think using very short names for variables is obfuscation?


More information about the dip.ideas mailing list