static foreach (Was: Re: static switch)

Orvid King blah38621 at gmail.com
Fri Mar 7 06:06:44 PST 2014


On 3/6/14, bearophile <bearophileHUGS at lycos.com> wrote:
> Timon Gehr:
>
>> foreach and static foreach should behave the same in all shared
>> aspects. (Unfortunately, this statement is somewhat messy to
>> formalize.)
>
> I am for deprecating unpacking of TypeTuples in foreach.
> Introducing such unpacking in static foreach just to deprecate it
> (hopefully a little) later is not wise.
>
> Bye,
> bearophile
>

Why would we want to not unpack type tuples in a foreach? What would
we be iterating over then? Unless of course the current behavior
(assuming there is no comma operator :P) of `foreach (T; (ubyte,
(ushort, short), uint))` is to iterate over ubyte, ushort, short, and
uint? If that is the case, I would be interested to know why the
decision was made. If not, then the question still remains, why would
you not want it to iterate over ubyte, (ushort, short), uint?


More information about the Digitalmars-d mailing list