August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Wednesday, 21 August 2013 at 17:53:21 UTC, Andrei Alexandrescu wrote:
> There's an inordinate amount of confusion around what we currently call "type tuple" (embodied in std's TypeTuple). I've been furious immediately as I got word that Walter called it that way, and it hasn't failed to make everybody else feel the same over the years.
>
> So: shall we use "template pack" going forward exclusively whenever we refer to that stuff? That way we can unambiguously use "tuple" for "value tuples, i.e. like mini-structs that group values together".
>
> Destroy. I mean criticize.
>
Many people started to use the sequence term. I think we should stick for that one.
Pack is kind of misleading IMO, as they automagically unpack.
So template argument sequence. If they happen to all be types/alias/values, types/alias/values sequence.
|
August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | Am 22.08.2013 12:05, schrieb Regan Heath:
> On Wed, 21 Aug 2013 18:53:06 +0100, Andrei Alexandrescu
> <SeeWebsiteForEmail@erdani.org> wrote:
>
>> There's an inordinate amount of confusion around what we currently call
>> "type tuple" (embodied in std's TypeTuple). I've been furious
>> immediately as I got word that Walter called it that way, and it hasn't
>> failed to make everybody else feel the same over the years.
>>
>> So: shall we use "template pack" going forward exclusively whenever we
>> refer to that stuff? That way we can unambiguously use "tuple" for
>> "value tuples, i.e. like mini-structs that group values together".
>>
>> Destroy. I mean criticize.
>
> After reading the thread I think it might help to try to define the
> important characteristics of them, and from that select the key
>
> Using this as a reference to my understanding:
> http://wiki.dlang.org/The_D_Programming_Language/Seq
>
> In particular the section:
> "Q: What's the deal with "auto-expansion"?"
>
> I think .. "type tuples" are:
> - Compile time
> - A kind of (list, set, group, or collection) of (parameters/arguments,
> initialisers, parent classes)
> - Flat i.e. "auto expanded" where used, not nested.
> - An alias for the elements it contains
> - A <thing> in which the ordering is important
>
> I am leaning toward the fact that they are an "alias" being a key
> property, that and the fact that they are a "list" or "set" of things.
> "Sequence" may be even better than list as it imples more heavily that the
> ordering is important.
>
> So, I am personally leaning toward dennis's suggestion of "Alias Sequence".
>
> But, I do worry a little about overloading the term "alias". However..
> TypeTuple is defined using "alias" so maybe they are the "same thing"
> after all.
>
> R
>
~but~ an "alias sequence" item is different to an alias
an alias can't contain untyped values:
alias x = 5;
alias y = "hallo";
an alias is an real accessible symbol - not just an position in a sequence
or am i wrong here?
|
August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to dennis luehring | On Thursday, 22 August 2013 at 10:32:06 UTC, dennis luehring wrote:
> ~but~ an "alias sequence" item is different to an alias
>
> an alias can't contain untyped values:
>
> alias x = 5;
> alias y = "hallo";
>
> an alias is an real accessible symbol - not just an position in a sequence
>
> or am i wrong here?
Function literal are passed around via alias all over the place.
|
August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Wednesday, 21 August 2013 at 17:53:21 UTC, Andrei Alexandrescu wrote:
> So: shall we use "template pack" going forward exclusively whenever we refer to that stuff?
I think it should be called either a "compile-time list" or a "static list", because it's a list of things which can be referred to at compile-time.
import std.typetuple;
void main()
{
int n;
alias T = TypeTuple!(int, 4, n);
static assert(T[1] == 4);
T[2]++;
assert(n == 1);
}
|
August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tommi | On Thursday, 22 August 2013 at 11:37:53 UTC, Tommi wrote:
> I think it should be called either a "compile-time list" ...
And if we go with "compile-time list", then we can follow the example of std.regex.ctRegex and name the thing "ctList".
|
August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to dennis luehring | On Thu, 22 Aug 2013 11:32:06 +0100, dennis luehring <dl.soluz@gmx.net> wrote: > Am 22.08.2013 12:05, schrieb Regan Heath: >> On Wed, 21 Aug 2013 18:53:06 +0100, Andrei Alexandrescu >> <SeeWebsiteForEmail@erdani.org> wrote: >> >>> There's an inordinate amount of confusion around what we currently call >>> "type tuple" (embodied in std's TypeTuple). I've been furious >>> immediately as I got word that Walter called it that way, and it hasn't >>> failed to make everybody else feel the same over the years. >>> >>> So: shall we use "template pack" going forward exclusively whenever we >>> refer to that stuff? That way we can unambiguously use "tuple" for >>> "value tuples, i.e. like mini-structs that group values together". >>> >>> Destroy. I mean criticize. >> >> After reading the thread I think it might help to try to define the >> important characteristics of them, and from that select the key >> >> Using this as a reference to my understanding: >> http://wiki.dlang.org/The_D_Programming_Language/Seq >> >> In particular the section: >> "Q: What's the deal with "auto-expansion"?" >> >> I think .. "type tuples" are: >> - Compile time >> - A kind of (list, set, group, or collection) of (parameters/arguments, >> initialisers, parent classes) >> - Flat i.e. "auto expanded" where used, not nested. >> - An alias for the elements it contains >> - A <thing> in which the ordering is important >> >> I am leaning toward the fact that they are an "alias" being a key >> property, that and the fact that they are a "list" or "set" of things. >> "Sequence" may be even better than list as it imples more heavily that the >> ordering is important. >> >> So, I am personally leaning toward dennis's suggestion of "Alias Sequence". >> >> But, I do worry a little about overloading the term "alias". However.. >> TypeTuple is defined using "alias" so maybe they are the "same thing" >> after all. >> >> R > > an alias is an real accessible symbol - not just an position in a sequence > > or am i wrong here? That's not quite what I was trying to say. I see it as the Alias Sequence being an alias for the entire sequence of symbols/expressions in the ordering in which they are given/defined. That said, to actually use them as aliases you need to name them, with an "alias" expression, e.g. // inspired by http://wiki.dlang.org/The_D_Programming_Language/Seq import std.stdio; template AliasSeqence(T...){ alias AliasSeqence = T; } alias one = AliasSeqence!(1); alias onetwo = AliasSeqence!(one,2); alias parented = AliasSeqence!(B,C); alias orphaned = AliasSeqence!(); // Parent list: interface C { } class B: orphaned { } // meaning: class B{ } class A: parented // meaning: class A: B,C{ } { this(int a, int b) { writefln("A.a = %d, A.b = %d", a, b); } } // Array literal element list: int[] digits = [0,onetwo,3]; // meaning: [0,1,2,3] void foo(int a, int b, int c) { writefln("foo(%d,%d,%d)", a, b, c); } void Foo(int a, int b, int c)() { writefln("Foo(%d,%d,%d)", a, b, c); } void main() { writefln("digits = %s", digits); // Function argument list (including struct constructor calls, excluding arguments to overloaded operators): foo(onetwo,3); // meaning: foo(1,2,3) // Template argument list (this is why you cannot have argument lists nested within argument lists). Foo!(0,onetwo)(); // meaning: Foo!(0,1,2) // Index argument list: int[] arr = new int[2]; arr[one] = 2; // meaning: arr[1] writefln("arr[one]=%d", arr[one]); // New argument list(s): A a = new A(onetwo); // meaning new A(1,2) } R -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tommi | On Thu, 22 Aug 2013 12:55:55 +0100, Tommi <tommitissari@hotmail.com> wrote: > On Thursday, 22 August 2013 at 11:37:53 UTC, Tommi wrote: >> I think it should be called either a "compile-time list" ... > > And if we go with "compile-time list", then we can follow the example of std.regex.ctRegex and name the thing "ctList". +1 I like this suggestion also. R -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tommi | On 2013-08-22 11:55:55 +0000, "Tommi" <tommitissari@hotmail.com> said: > On Thursday, 22 August 2013 at 11:37:53 UTC, Tommi wrote: >> I think it should be called either a "compile-time list" ... > > And if we go with "compile-time list", then we can follow the example of std.regex.ctRegex and name the thing "ctList". Will .tupleof become .ctlistof? -- Michel Fortin michel.fortin@michelf.ca http://michelf.ca |
August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Michel Fortin | On Thursday, 22 August 2013 at 12:06:11 UTC, Michel Fortin wrote:
> On 2013-08-22 11:55:55 +0000, "Tommi" <tommitissari@hotmail.com> said:
>
>> On Thursday, 22 August 2013 at 11:37:53 UTC, Tommi wrote:
>>> I think it should be called either a "compile-time list" ...
>>
>> And if we go with "compile-time list", then we can follow the example of std.regex.ctRegex and name the thing "ctList".
>
> Will .tupleof become .ctlistof?
strictly speaking I think it would be an alias list, so perhaps .aliasList
|
August 22, 2013 Re: s/type tuple/template pack/g please | ||||
---|---|---|---|---|
| ||||
Posted in reply to Michel Fortin | On Thursday, 22 August 2013 at 12:06:11 UTC, Michel Fortin wrote:
> On 2013-08-22 11:55:55 +0000, "Tommi" <tommitissari@hotmail.com> said:
>
>> On Thursday, 22 August 2013 at 11:37:53 UTC, Tommi wrote:
>>> I think it should be called either a "compile-time list" ...
>>
>> And if we go with "compile-time list", then we can follow the example of std.regex.ctRegex and name the thing "ctList".
>
> Will .tupleof become .ctlistof?
I think it could be .fieldsof
|
Copyright © 1999-2021 by the D Language Foundation