A Discussion of Tuple Syntax
Jonathan M Davis
jmdavisProg at gmx.com
Tue Aug 20 20:39:12 PDT 2013
On Tuesday, August 20, 2013 23:25:03 Michel Fortin wrote:
> On 2013-08-21 00:38:30 +0000, Andrei Alexandrescu
>
> <SeeWebsiteForEmail at erdani.org> said:
> > 1. What do we need?
>
> I think D needs less tuples. It has two kinds (language kind and
> Phobos's kind), which is confusing. It should have just one that covers
> most use cases.
I honestly think that trying to combine Tuple and TypeTuple would increase the
confusion, because you'd be forcing the compiler to decide what you meant in
any given situation, and from the programmer's perspective, it will frequently
be non-obvious whether what's being done is being done at compile time or at
runtime.
The main problem I see is that TypeTuple is badly named. Heck, the fact that
it's even referred to as a tuple is problematic, since it isn't really, as it
always expands. And the fact that it's the "built-in" tuple but requires a
library solution to be able to actually declare it is a bit odd. So, I think
that creating as syntax for the built-in tuples in order to get rid of
TypeTuple would clean things up.
But I see no reason to try and combine any of that with Tuple, as Tuple and
TypeTuple do fundamentally different things. The main gain I see is simply in
cleaning up the naming mess, and by making it so that the built-in tuple
actually has a built-in syntax, the language is cleaner and should be easier
to understand (especially if we can come up with a name other than tuple or
built-in tuple to call them so that they stop getting confused with Tuple).
- Jonathan M Davis
More information about the Digitalmars-d
mailing list