I have a feature request: "Named enum scope inference"
Alex Rønne Petersen
alex at lycus.org
Fri Sep 28 19:38:11 PDT 2012
On 29-09-2012 04:31, Tommi wrote:
> On Saturday, 29 September 2012 at 02:01:15 UTC, Alex Rønne Petersen wrote:
>> The first issue with this proposal that comes to mind is this:
>>
>> enum Foo { bar }
>>
>> void func(Foo f)
>> {
>> // ...
>> }
>>
>> // ...
>>
>> Foo bar = Foo.bar;
>> func(bar); // ?
>
> Maybe it should simply throw a compile error about the ambiguity of
> 'bar' in 'func(bar)'. But if the local variable 'bar' if not of Foo
> type, then there's no ambiguity. Or, if the local variable 'bar' is a
> compile time constant that evaluates to Foo.bar, then there's no
> ambiguity either.
Regardless of the conditions under which to throw an error, it would be
a breaking change.
--
Alex Rønne Petersen
alex at lycus.org
http://lycus.org
More information about the Digitalmars-d
mailing list