Tuple/TypeTuple etc.

Jonathan M Davis jmdavisProg at gmx.com
Fri Aug 16 13:40:14 PDT 2013


On Friday, August 16, 2013 22:30:11 Dicebot wrote:
> On Friday, 16 August 2013 at 20:22:49 UTC, H. S. Teoh wrote:
> > ...
> 
> Term "tuple" comes from math and means "ordered set of elements".
> In that sense anonymous struct with unnamed fields _is_ a tuple
> and I thing std.typecons.Tuple is the place where naming is fine.
> 
> It is re-using the term for compile-time entity of the language
> that causes confusion. While it matches the mathematical
> definition of "tuple" too, its practical meaning for language is
> much more than that and naming should express it.

In addition, the built-in tuples are not at all what most programmers think 
about when they think about tuples. Tuples are supposed to be nestable, 
whereas the built-in tuples are always flat. So, if anything, it's calling the 
built-in tuples tuples which is the problem. "Sequence" seems to be a semi-
popular suggestion for a better term whenever it comes up, but that poses its 
own set of difficulties.

- Jonathan M Davis


More information about the Digitalmars-d mailing list