DIPX: Enum Literals / Implicit Selector Expression

Steven Schveighoffer schveiguy at gmail.com
Wed Jul 6 14:23:21 UTC 2022


On 7/6/22 3:05 AM, bauss wrote:
> On Tuesday, 5 July 2022 at 15:06:01 UTC, Steven Schveighoffer wrote:
>>
>> I thought that too. But there is existing syntax that might interfere: 
>> `cond ? value1 :value2`.
>>
>> I don't know enough to be sure, so I just picked one that isn't used.
>>
> 
> I don't think that would interfere, because `cond ? value1 value2` isn't 
> allowed, so if value2 is an enum value then it would be `cond ? value1 : 
> :value2`

Probably fine, I agree. Again, just being cautious. I will stress also 
that my point isn't to propose a specific syntax, but a specific idea.

Note that even if there is not an ambiguity in the grammar, there is 
still the confusion of the person reading such code.

-Steve


More information about the Digitalmars-d mailing list