DIP1044---"Enum Type Inference"---Formal Assessment
Paul Backus
snarwin at gmail.com
Thu May 11 14:10:48 UTC 2023
On Thursday, 11 May 2023 at 13:31:58 UTC, Steven Schveighoffer
wrote:
> On 5/10/23 11:22 PM, Paul Backus wrote:
>> In fact, for this particular example, there are actually two
>> enums in the DMD source code that these symbols could be
>> coming from: `enum TargetOS` in `cli.d`, and `enum OS` in
>> `target.d`. So you would have to scroll up and look at the
>> imports to disambiguate.
>
> Then you misunderstand the DIP (as did Walter). There is only
> one enum that can be involved -- typeof(target.os).
Oh no, I'm perfectly aware that, from the compiler's perspective,
it would be unambiguous--only one of the two enums would actually
be in scope. But as a human reader, in order to figure out which
one, I'd have to scroll to the top of the file and read through
~25 lines of imports (or rely on tooling, but there are contexts
where that isn't available, like a Github code review).
More information about the Digitalmars-d-announce
mailing list