A Discussion of Tuple Syntax

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Aug 20 13:20:45 PDT 2013


On 8/20/13 8:43 AM, Kenji Hara wrote:
> 2013/8/20 Dicebot <public at dicebot.lv <mailto:public at dicebot.lv>>
>
>     What we have here are two completely different _built-in_ tuple
>     types. "T" is pure template arguments list and is pretty much equal
>     TypeTuple!(int, int). But what is "args"? It uses the very same
>     built-in tuple syntax but it is much closer to std.typecons.Tuple in
>     its behavior (actually, latter is implemented in terms of it as I
>     was pointed out) - it is an entity that provides abstraction of top
>     of group of run-time values. It does not have any binary structure
>     on its own (built on top of existing values) but observable semantic
>     are very "run-time'ish".
>
>
> "args" is a built-in tuple of two function parameter variables. In
> binary level, args[0] and args[1] could be bounded to completely
> individual storage. (Even if args[1] is on stack, args[0] may be on
> register)
> On the other hand, std.typecons.Tuple is a struct. Its second field has
> the memory address which follows of the first field.

Ome question would be whether appropriate inlining could solve the 
performance disadvantage of Tuple.

Andrei



More information about the Digitalmars-d mailing list