A Discussion of Tuple Syntax

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Aug 19 14:03:50 PDT 2013


On Monday, 19 August 2013 at 20:46:02 UTC, Andrei Alexandrescu wrote:
> It's stuff like this that's just useless and gives a bad
> direction to the whole discussion. There's hardly anything
> wrong with auto x = t1[2] or auto gr = t1[1], but once the
> bikeshed is up for painting, the rainbow won't suffice.

I started this discussion to build on Kenji's DIP, which discusses 
destructuring and pattern matching syntax in addition to tuple literal 
syntax, as well as the previous discussion that's already gone on in the 
two "DIP discussion" threads. Are you saying that you dislike the 
destructuring/pattern matching discussion as a whole?

I'm saying that there's a mix of useful stuff and just syntactic 
additions that are arguably less so. In my opinion:

a) destructuring tuples in auto declarations - good to have:

auto (a, b, c) = functionReturningTupleOrStaticArrayWith3Elements();

b) syntactic support for ignoring certain members in a destructuring - 
is that really needed?

auto (a, ?, c) = functionReturningTupleOrStaticArrayWith3Elements();


Andrei


More information about the Digitalmars-d mailing list