Its not uncommon that I need a compile-time list that counts from 0..n.

It seems like the only 'standard' way to do this is `std.typecons.staticIota`, which is undocumented and has package level access.

Looking through the archives I've seen 3 suggestions:

1. Expose staticIota as-is.

2. Implement `static foreach` (http://wiki.dlang.org/DIP57), allowing loop unrolling over a normal `iota`

3. `toTypeTuple` (https://github.com/D-Programming-Language/phobos/pull/1472), which creates a tuple out of a range, so you could use `toTypeTuple!iota`.

4. Everyone implements their own staticIota.

1 seems like the easiest, though 3 may be the more generally useful (and if it were implemented, might make staticIota redundant). 2 is nice though it only covers the looping case.

I was just wondering if there is any plan for one of these -- currently I find myself using `staticIota` from std.typecons, relying on the fact that I can access a package-level symbol even though I'm not supposed to be able to.

Reply via email to