Pair literal for D language
Mason McGill via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jun 29 09:03:05 PDT 2014
On Saturday, 28 June 2014 at 21:12:06 UTC, Timon Gehr wrote:
> On 06/28/2014 06:11 PM, Mason McGill wrote:
>> On Saturday, 28 June 2014 at 09:15:29 UTC, Dicebot wrote:
>>> On Friday, 27 June 2014 at 22:01:21 UTC, Mason McGill wrote:
>>>> I like DIP54 and I think the work on fixing tuples is
>>>> awesome, but I
>>>> have 1 nit-picky question: why is it called
>>>> "TemplateArgumentList"
>>>> when it's not always used as template arguments?
>>>>
>>>> void func(string, string) { }
>>>>
>>>> TypeTuple!(string, string) var;
>>>> var[0] = "I'm nobody's ";
>>>> var[1] = "template argument!";
>>>> f(var);
>>>>
>>>> Why not a name that emphasizes the entity's semantics, like
>>>> "StaticList"/"ExpandingList"/"StaticTuple"/"ExpandingTuple"?
>>>
>>> Because it is defined by template argument list and has
>>> exactly the
>>> same semantics as one. And semantics are unique and obscure
>>> enough
>>> that no other name can express it precisely.
>>
>> Understood. I was just expressing my initial impression: that
>> it seemed
>> strange that a symbol declared as a `TemplateArgumentList` was
>> neither
>> passed nor received as template arguments.
>
> That would be strange, but it isn't.
>
> TypeTuple!(string, string) var;
> ^~~~~~~~~~~~~~~~~
> passed here
>
>
> alias TypeTuple(T...)=T; <- aliased here
> ^~~~
> received here
>
> Hence:
>
> TypeTuple!(string, string) var;
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
> this is actually the template argument list that was passed
>
> In any case, I just call it 'Seq'.
I understand, but I was talking about `var` being referred to as
a `TemplateArgumentList` when it's not used as such. It's used as
an `ArgumentList`, just not a `TemplateArgumentList`.
Cheers,
Mason
More information about the Digitalmars-d
mailing list