Tuples
Jonathan M Davis
jmdavisProg at gmx.com
Sun May 26 19:31:37 PDT 2013
On Monday, May 27, 2013 04:24:51 Diggory wrote:
> It also shouldn't break any code since the only addition to
> TypeTuple is a check to make sure that the undocumented behaviour
> of using it with non-types is disallowed, and in the case that
> this undocumented feature is used the code can simply switch to
> StaticTuple and be done.
Well, changing TypeTuple to only accept types _will_ break code. It gets used
quite heavily with foreach to get a static foreach, and that can involve using
expressions instead of types. Anyone using TypeTuple heavily knows what it can
do and will probably have used it for expressions at some point. It wouldn't
surprise me in the least if it's already done in Phobos, and there's no way to
know how much it is or isn't done elsewhere.
Because you're generally in control of the TypeTuples that you're using (you
aren't usually getting the from APIs and the like), I really don' think that
the fact that it can hold both types and expressions is a big deal. I expect
that it pretty much never causes problems in actual code. It just makes it so
that the name sucks. I don't think that we'd gain much (if anything) by
separating out TypeTuple into three different types. Renaming it would be nice,
but given the current push to stop making breaking changes like that, I would
expect that at best, we'd get an alias with a better name.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list