Re: Generating switch at Compile Time

2017-04-17 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 13 April 2017 at 21:06:52 UTC, Jesse Phillips wrote: I realize that this is likely really pushing the compile time generation but a recent change to the switch statement[1] is surfacing because of this usage. uninitswitch2.d(13): Deprecation: 'switch' skips declaration of

Re: Generating switch at Compile Time

2017-04-17 Thread ag0aep6g via Digitalmars-d-learn
On 04/17/2017 09:29 PM, Jesse Phillips wrote: On Thursday, 13 April 2017 at 21:33:28 UTC, ag0aep6g wrote: [...] By the way, in my opinion, `case li[0]:` shouldn't compile with the static immutable `list`. `list` and `li[0]` are dynamic values. The compiler only attempts (and succeeds) to

Re: Generating switch at Compile Time

2017-04-17 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 13 April 2017 at 21:33:28 UTC, ag0aep6g wrote: That's not a static foreach. It's a normal run-time foreach. The switch jumps into the loop body without the loop head ever executing. The compiler is correct when it says that initialization of li is being skipped. Good good. I did

Re: Generating switch at Compile Time

2017-04-13 Thread ag0aep6g via Digitalmars-d-learn
On 04/13/2017 11:06 PM, Jesse Phillips wrote: - [...] private static immutable list = AliasSeq!( tuple("a", "q"), tuple("b", "r"), ); [...] switch(search) { --->foreach(li; list) { // li initialization is skipped

Generating switch at Compile Time

2017-04-13 Thread Jesse Phillips via Digitalmars-d-learn
I realize that this is likely really pushing the compile time generation but a recent change to the switch statement[1] is surfacing because of this usage. uninitswitch2.d(13): Deprecation: 'switch' skips declaration of variable uninits witch2.main.li at uninitswitch2.d(14)