A Discussion of Tuple Syntax

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Aug 20 14:50:24 PDT 2013


On Tue, Aug 20, 2013 at 05:12:43AM +0200, Meta wrote:
> Aggh, misposted. Let's try that again.
> 
> On Tuesday, 20 August 2013 at 02:51:20 UTC, Meta wrote:
> >On Tuesday, 20 August 2013 at 01:06:28 UTC, H. S. Teoh wrote:
> >>Actually, reading through DIP32 again, it sounds like Kenji is
> >>proposing the *same* syntax for both built-in tuples and
> >>std.typecons.Tuple. In the code example under "Generic
> >>type/expression tuple syntax", he refers to them respectively as
> >>"tuple type" and "tuple value". Mixing is also allowed (e.g., in the
> >>"alias Fields" line).
> 
> Maybe mixing should be disallowed, then, unless your tuple was
> constructed from a variadic template argument list.
[...]

I don't like this "unless". Either we support mixing, or we don't.
Adding in "unless" adds unnecessary complication, which will inevitably
have a ripple effect that adds complications everywhere. Next thing you
know, Phobos will acquire a template that returns a tuple of its
arguments -- as a workaround for the inability to manually construct a
mixed tuple, and then we'll have a rehash of this thread, this time
surrounding how to merge/get rid of std.typecons.createMixedTuple.

I think any workable design of tuples must include a sane way of working
with mixed tuples, because they can and do appear in template arguments.


T

-- 
Без труда не выловишь и рыбку из пруда. 


More information about the Digitalmars-d mailing list