DIP19: Remove comma operator from D and provision better syntactic support for tuples

Jonathan M Davis jmdavisProg at gmx.com
Wed Sep 26 14:29:47 PDT 2012


On Wednesday, September 26, 2012 21:54:44 foobar wrote:
> 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.

Of course, they're not equal. One is a Tuple and one is a MyTuple. Why on 
earth would you expect them to be considered equal? Just use Tuple. And it's 
not like you'd be using MyTuple if tuples were built-in. You'd just use the 
built-in tuples. So, this really makes no sense to me at all.

- Jonathan M Davis


More information about the Digitalmars-d mailing list