Thoughts on possible tuple semantics

Dicebot public at dicebot.lv
Thu Aug 22 07:03:12 PDT 2013


On Thursday, 22 August 2013 at 13:01:51 UTC, deadalnix wrote:
> It is a sequence of types. It can be used to declare a sequence 
> of variables.

That implies defining "sequence of X" as special entity on 
official spec and update 'alias', 'typeof' and template docs to 
reference it as a special case.

> In my proposal, tuple are a library construct. The proposal 
> introduce the necessary tooling to implement them nicely.
>
> is(typeof(42, 42) == (int, int));
> is(typeof(tuple(42, 42)) == <a library defined struct>);
>
> It could be defined as follow :
>
> struct Tuple(T...) {
>     T expand;
>     alias expand this;
> }

It is exactly what we have right now. So you think having two 
different types of expression/value tuples is fine?

>> Also you don't seem to cover mixed sequences which are 
>> essential to D templates.
>
> Theses are alias sequences.

As I have already said, it is no less confusing to classify as 
alias sequence something that is not limited to aliases.


More information about the Digitalmars-d mailing list