Type Inference for Struct/Enum Literals
ryuukk_
ryuukk.dev at gmail.com
Mon Jul 8 15:44:21 UTC 2024
On Monday, 8 July 2024 at 10:45:22 UTC, Nick Treleaven wrote:
> On Monday, 8 July 2024 at 07:02:34 UTC, ryuukk_ wrote:
>> On Sunday, 7 July 2024 at 19:07:10 UTC, Nick Treleaven wrote:
>>> On Saturday, 6 July 2024 at 08:04:36 UTC, ryuukk_ wrote:
>>>> `MySelfExplanatoryType flag = MySelfExplanatoryType.A |
>>>> MySelfExplanatoryType.B MySelfExplanatoryType.C;`
>>>
>>> You could write:
>>> ```d
>>> auto flag = { with (MySelfExplanatoryType) return A | B | C;
>>> }();
>>> ```
>>
>>
>> No, this syntax is just bad, it's unreadable and over
>> engineered
>
> It's not great, but it does do what you said the point of the
> feature was:
>
>> to avoid repetition and to make code more concise in places
>> that are relevant
>
> I only suggest it for cases when using an alias is not
> acceptable.
Hence the feature suggestion, because the current solutions are
not good
More information about the dip.ideas
mailing list