Re: Accessing types by context

2016-06-29 Thread Jacob Carlborg via Digitalmars-d
On 29/06/16 05:11, Hiemlick Hiemlicker wrote: Suppose one has void test(myEnum e) enum myEnum { A,B,C } It would be very cool if we could do test(A) instead of test(myEnum.A). by context, the compiler can look first in the scope for something named A then look in the enum itself and prepend

Re: Accessing types by context

2016-06-29 Thread Lodovico Giaretta via Digitalmars-d
On Wednesday, 29 June 2016 at 10:51:39 UTC, qznc wrote: On Wednesday, 29 June 2016 at 03:11:52 UTC, Hiemlick Hiemlicker wrote: Suppose one has void test(myEnum e) enum myEnum { A,B,C } It would be very cool if we could do test(A) instead of test(myEnum.A). by context, the compiler can look

Re: Accessing types by context

2016-06-29 Thread qznc via Digitalmars-d
On Wednesday, 29 June 2016 at 03:11:52 UTC, Hiemlick Hiemlicker wrote: Suppose one has void test(myEnum e) enum myEnum { A,B,C } It would be very cool if we could do test(A) instead of test(myEnum.A). by context, the compiler can look first in the scope for something named A then look in

Re: Accessing types by context

2016-06-29 Thread Anonymouse via Digitalmars-d
On Wednesday, 29 June 2016 at 05:06:08 UTC, Hiemlick Hiemlicker wrote: On Wednesday, 29 June 2016 at 03:50:35 UTC, Carl Vogel wrote: On Wednesday, 29 June 2016 at 03:11:52 UTC, Hiemlick [...] Doesn't the with statement solve your problem here? with (myEnum) { test(A); test(B);

Re: Accessing types by context

2016-06-28 Thread Hiemlick Hiemlicker via Digitalmars-d
On Wednesday, 29 June 2016 at 04:34:26 UTC, Chang Long wrote: On Wednesday, 29 June 2016 at 03:11:52 UTC, Hiemlick Hiemlicker wrote: test(myEnum.A | myEnum.B & myEnum.C). I like this: myEnum.( A | B & C) == myEnum.A | myEnum.B & myEnum.C Does that even work? Regardless, You still have

Re: Accessing types by context

2016-06-28 Thread Hiemlick Hiemlicker via Digitalmars-d
On Wednesday, 29 June 2016 at 03:50:35 UTC, Carl Vogel wrote: On Wednesday, 29 June 2016 at 03:11:52 UTC, Hiemlick Hiemlicker wrote: Suppose one has void test(myEnum e) enum myEnum { A,B,C } [...] Doesn't the with statement solve your problem here? with (myEnum) { test(A); test(B);

Re: Accessing types by context

2016-06-28 Thread Chang Long via Digitalmars-d
On Wednesday, 29 June 2016 at 03:11:52 UTC, Hiemlick Hiemlicker wrote: test(myEnum.A | myEnum.B & myEnum.C). I like this: myEnum.( A | B & C) == myEnum.A | myEnum.B & myEnum.C

Re: Accessing types by context

2016-06-28 Thread Carl Vogel via Digitalmars-d
On Wednesday, 29 June 2016 at 03:11:52 UTC, Hiemlick Hiemlicker wrote: Suppose one has void test(myEnum e) enum myEnum { A,B,C } [...] Doesn't the with statement solve your problem here? with (myEnum) { test(A); test(B); test(C); }

Accessing types by context

2016-06-28 Thread Hiemlick Hiemlicker via Digitalmars-d
Suppose one has void test(myEnum e) enum myEnum { A,B,C } It would be very cool if we could do test(A) instead of test(myEnum.A). by context, the compiler can look first in the scope for something named A then look in the enum itself and prepend myEnum internally. For flags, it would