with for reduced bloat

Jonathan Marler johnnymarler at gmail.com
Mon Dec 24 02:13:45 UTC 2018


On Monday, 24 December 2018 at 02:04:26 UTC, Michelle Long wrote:
> enum X { A, B, C}
>
> void foo(X x);
>
> foo(X.A);
>
>
> vs
>
>
> enum X { A, B, C}
>
> void foo(with X x);
>
> foo(A);

You could even support this by default, without requiring `with`. 
It could break code but it's probably rare that symbols passed to 
an enum argument collide with members of the enum itself, i.e.

const A = X.B;
Foo(A); // this is probably rare

But we would have to decide which one to give precedence, the 
enum member scope or the the current scope.


More information about the Digitalmars-d mailing list