On Tuesday, 25 September 2012 at 21:02:49 UTC, Andrei Alexandrescu wrote:

I agree. That's why I want to take the minimum amount of steps to make library tuples work. That minimum amount may be 1, i.e. just implement deconstruction.

Andrei

Library tuples have broken semantics.
Tuples supposed to have _structural_ typing which AFAIK can only be correctly implemented in language.

import std.typecons.TypeTuple;

struct MyTuple(T...)() {}

auto libTup = tuple(123, "hello");
MyTuple myTup = libTup; // broken

This is broken cause structs in D are nominally typed and even though both pack the same inner-types, they are not equal. The problem with the lib solution is the confusion and broken semantics, _not_ the "tuple()" syntax. Sure, it's long and annoying to type for a [should be] common construct, but tuple *is* clear and readable, as you pointed out yourself. So syntax wise, I'm fine with both tuple(...) and a shorter syntax with some sort of parens-like character. But please, let's get at least the semantics absolutely right.

I don't have a good suggestion how to fix this with no or minimal code breakage, but I don't thing that adding broken features the the mix helps any.

Reply via email to