CT foreaches

Quirin Schroll qs.il.paperinik at gmail.com
Fri Aug 1 18:06:27 UTC 2025


On Friday, 1 August 2025 at 16:45:04 UTC, Nick Treleaven wrote:
> On Friday, 1 August 2025 at 15:47:47 UTC, monkyyy wrote:
>> On Friday, 1 August 2025 at 15:15:35 UTC, Nick Treleaven wrote:
>>> The confusing thing is that enum there is silently ignored. I 
>>> think we could add an error for that.
>>
>> That would be a breaking change now, most code swapped from 
>> runtime to ct should continue working tho, better to just 
>> implement it
>
> Not really, no one should have used enum/alias with a 
> non-static ForeachRangeStatement because (as you pointed out), 
> it wasn't in the spec. If they did use it, they'd probably 
> realize that those storage classes had no effect.

Making non-static `foreach (enum x; l .. u)` an error would be 
fairly easy. It’s just a parser issue. The error message could 
say: Use `static foreach`. I’ll have a go on this.


More information about the Digitalmars-d mailing list