Re: Wait, what? What is AliasSeq?
So AliasSeq = Tuples?
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 22:22:02 UTC, Walter Bright wrote: On 7/7/2015 2:20 PM, David Nadlinger wrote: On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. Apparently Walter was opposed to using List, as that would somehow imply "linked list". I opposed it because lists are not indexable, and tuples are. huh? A List is an ordered sequence. Both are indexable. https://en.wikipedia.org/wiki/Enumeration Wiki: A list is any enumeration of a set of items. List or lists may also refer to: and Some sets can be enumerated by means of a natural ordering (such as 1, 2, 3, 4, ... for the set of positive integers), but in other cases it may be necessary to impose a (perhaps arbitrary) ordering. Why you use that logic to choose a word is a kinda strange. A List doesn't imply much except what people want it to. You are choosing a single interpretation to not use it, when there are many. A List is what someone creates with a pen and paper. It has an ordering(the first one and last one). A linked list or "unordered list" are just versions of a list. A list is a list is a list! Regardless, it's probably not the best term to use TArgList or TArgSeq would be more descriptive.
Re: Wait, what? What is AliasSeq?
On 07/07/2015 11:16 PM, Andrei Alexandrescu wrote: Template arguments are indexable, so "sequence" doesn't quite apply. https://en.wikipedia.org/wiki/Sequence#Indexing
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. Apparently Walter was opposed to using List, as that would somehow imply "linked list". — David
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 21:20:54 UTC, David Nadlinger wrote: On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. Apparently Walter was opposed to using List, as that would somehow imply "linked list". — David List? I thought we had settled on: std.meta.Arguments
Re: Wait, what? What is AliasSeq?
On 7/7/15 5:32 PM, Daniel N wrote: On Tuesday, 7 July 2015 at 21:20:54 UTC, David Nadlinger wrote: On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. Apparently Walter was opposed to using List, as that would somehow imply "linked list". List? I thought we had settled on: std.meta.Arguments That's what AliasSeq replaced. Arguments was not a very good name IMO. See my post on it here: http://forum.dlang.org/post/mmhfs1$2jc5$1...@digitalmars.com I'm unsure if Andrei is referring to Arguments or TypeTuple when he says "bad names". -Steve
Re: Wait, what? What is AliasSeq?
On 7/7/2015 2:20 PM, David Nadlinger wrote: On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. Apparently Walter was opposed to using List, as that would somehow imply "linked list". I opposed it because lists are not indexable, and tuples are.
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. What happened? Why are we replacing a crappy term with another crappy term? Andrei AliasSeq?? What is that even supposed to mean? Are we just throwing random words together?
Re: Wait, what? What is AliasSeq?
On 7/7/15 5:24 PM, Timon Gehr wrote: On 07/07/2015 11:16 PM, Andrei Alexandrescu wrote: Template arguments are indexable, so "sequence" doesn't quite apply. https://en.wikipedia.org/wiki/Sequence#Indexing Hmm, fair enough. Sequential as opposed to associative. https://en.wikipedia.org/wiki/Sequence_container_(C%2B%2B) also comes to mind. Then, at least let's use the whole darn word. Doesn't seem like the short form is helping a lot here. Andrei
Re: Wait, what? What is AliasSeq?
On 7/7/15 5:20 PM, David Nadlinger wrote: On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. Apparently Walter was opposed to using List, as that would somehow imply "linked list". And rightly so. It's just that "sequence" doesn't seem better. -- Andrei
Re: Wait, what? What is AliasSeq?
On 7/7/15 7:29 PM, Andrei Alexandrescu wrote: On 7/7/15 5:24 PM, Timon Gehr wrote: On 07/07/2015 11:16 PM, Andrei Alexandrescu wrote: Template arguments are indexable, so "sequence" doesn't quite apply. https://en.wikipedia.org/wiki/Sequence#Indexing Hmm, fair enough. Sequential as opposed to associative. https://en.wikipedia.org/wiki/Sequence_container_(C%2B%2B) also comes to mind. Then, at least let's use the whole darn word. Doesn't seem like the short form is helping a lot here. Andrei In fact thinking of it AliasArray seems most descriptive. -- Andrei
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 22:52:09 UTC, rsw0x wrote: AliasSeq?? What is that even supposed to mean? Are we just throwing random words together? A sequence of aliases, personally I think it is a much better name. But maybe seq could be replaced with something else, though I don't really mind seq. AliasList seems a little bit better.
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 23:30:05 UTC, Andrei Alexandrescu wrote: In fact thinking of it AliasArray seems most descriptive. -- Andrei I like this as well, but calling it an array might make people think you can assign to its elements.
Re: Wait, what? What is AliasSeq?
On 7/7/15 7:32 PM, Tofu Ninja wrote: On Tuesday, 7 July 2015 at 23:30:05 UTC, Andrei Alexandrescu wrote: In fact thinking of it AliasArray seems most descriptive. -- Andrei I like this as well, but calling it an array might make people think you can assign to its elements. Well it depends on the element type, e.g. you can't assign to slots of an array of immutable elements because you can't assign the individual types to start with. By extension you can't assign to elements of an array of aliases because you can't assign an alias to another to start wityh. -- Andrei
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 23:30:25 UTC, Tofu Ninja wrote: On Tuesday, 7 July 2015 at 22:52:09 UTC, rsw0x wrote: AliasSeq?? What is that even supposed to mean? Are we just throwing random words together? A sequence of aliases, personally I think it is a much better name. But maybe seq could be replaced with something else, though I don't really mind seq. AliasList seems a little bit better. it's far closer to a tuple, list, or array than a sequence.
Re: Wait, what? What is AliasSeq?
On 07/08/2015 01:30 AM, Andrei Alexandrescu wrote: In fact thinking of it AliasArray seems most descriptive. -- Andrei Not really. https://en.wikipedia.org/wiki/Array_data_structure https://en.wikipedia.org/wiki/Array_data_type Neither is is fitting.
Re: Wait, what? What is AliasSeq?
On 08-Jul-2015 02:29, Andrei Alexandrescu wrote: On 7/7/15 5:24 PM, Timon Gehr wrote: On 07/07/2015 11:16 PM, Andrei Alexandrescu wrote: Template arguments are indexable, so "sequence" doesn't quite apply. https://en.wikipedia.org/wiki/Sequence#Indexing Hmm, fair enough. Sequential as opposed to associative. https://en.wikipedia.org/wiki/Sequence_container_(C%2B%2B) also comes to mind. Then, at least let's use the whole darn word. Doesn't seem like the short form is helping a lot here. I believe Seq is quite fitting as the venerable TypeTuple was used frequently enough to benefit from shorter form IMHO. Scala's Seq[T] is a sequential container (pretty much anything array-like), so there is precedent. -- Dmitry Olshansky
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 01:26:22 UTC, rsw0x wrote: A sequence of aliases, personally I think it is a much better name. But maybe seq could be replaced with something else, though I don't really mind seq. AliasList seems a little bit better. it's far closer to a tuple, list, or array than a sequence. Mmh, TypeTuple had 2 problems, it didn't solely consist of types, and the term tuple is overloaded by value tuples. But indeed AliasTuple would be descriptive name IMHO.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 08:53:52 UTC, Martin Nowak wrote: On Wednesday, 8 July 2015 at 01:26:22 UTC, rsw0x wrote: A sequence of aliases, personally I think it is a much better name. But maybe seq could be replaced with something else, though I don't really mind seq. AliasList seems a little bit better. it's far closer to a tuple, list, or array than a sequence. Mmh, TypeTuple had 2 problems, it didn't solely consist of types, and the term tuple is overloaded by value tuples. But indeed AliasTuple would be descriptive name IMHO. Tuples are not expected to auto unpack either.
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 22:22:02 UTC, Walter Bright wrote: On 7/7/2015 2:20 PM, David Nadlinger wrote: On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. Apparently Walter was opposed to using List, as that would somehow imply "linked list". I opposed it because lists are not indexable, and tuples are. Linked lists are not indexable, but the term list doesn't necessarily imply that it's a linked list. The term list just means that you have a group of items in linear order. In fact, if you're looking for a generic name for any kind of linear group of items (be it a linked list or an array or whatever), I would think that list is about as generic as you get. And it says nothing about indexability one way or the other. The core problem here is that the thing that we're trying to name here is too much of a hodgepodge of different things to name it well. It's not really a tuple, since it's not nestable, but list and sequence are kind of odd names too, because in programming, with almost everything other than a tuple, you expect all of the items in the structure to be the same type, which isn't the case here. Going with Alias seems to solve the problem of whether it holds types or values or symbols well. It also deals well with whether it's used for arguments or parameters or something else. So, I think that going with Alias is a good move. As for Seq, it's kind of ugly, but if understand that it's Sequence, I think that that fits well enough. Personally, I'd prefer List over Seq, but if you're vetoing List, then I don't know what else we're going to go with. _Nothing_ fits perfectly. TypeTuple/AliasSeq/Whatever is just too unique and too much of a hodgepodge for any name to really well. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. What happened? Why are we replacing a crappy term with another crappy term? Andrei What basically happened is that I discussed that with pretty much everybody (including you at DConf) and really, nothing better came up.
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 23:30:05 UTC, Andrei Alexandrescu wrote: In fact thinking of it AliasArray seems most descriptive. -- I think that that would be a really bad move, since we already use the term array for three other completely unrelated items in the language, and it really isn't an array in any kind of classic sense. It's an indexable list of heterogenous items where that list is a compile-time construct and not a runtime data structure. There's really nothing else like it, and the term array arguably carries even more baggage with it than tuple, and tuple has always been a bad fit - both because it implies that you can nest them (whereas they self-flatten) and because we already have tuples with std.typecons.Tuple. We'd be going from having two tuple types and three array types to one tuple type and four array types. Much as I think that it's a mistake to use the term tuple for TypeTuple/AliasSeq/etc., I think that it would be far better to name it AliasTuple than AliasArray. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 08:59:15 UTC, deadalnix wrote: On Wednesday, 8 July 2015 at 08:53:52 UTC, Martin Nowak wrote: On Wednesday, 8 July 2015 at 01:26:22 UTC, rsw0x wrote: A sequence of aliases, personally I think it is a much better name. But maybe seq could be replaced with something else, though I don't really mind seq. AliasList seems a little bit better. it's far closer to a tuple, list, or array than a sequence. Mmh, TypeTuple had 2 problems, it didn't solely consist of types, and the term tuple is overloaded by value tuples. But indeed AliasTuple would be descriptive name IMHO. Tuples are not expected to auto unpack either. Yeah. Every name sucks. Alias seems to solve the first half of the name reasonably well, but nothing that anyone has come up with really solves the second half. TypeTuples/AliasSeqs/Whatever really aren't tuples, because they don't nest, and they auto flatten (which pretty much no who has dealt with tuples before is going to expect from a tuple). So, tuples really gives the wrong impression, but it has the advantage of implying that it holds a heterogenous group of items, whereas pretty much anything else risks implying that it holds a homogeneous list of items. Array (as Andrei has suggested) is already a very overloaded term in D, and it implies a runtime data structure, which this isn't. Certainly, when folks think of arrays, they're not going to think of anything like TypeTuple/AliasSeq. List is by far the most generic, but it doesn't imply indexability, so Walter doesn't like - though Seq doesn't imply indexability either, so if that's his complaint, I don't see how it makes much differences whether we go with List or Seq. They seem pretty interchangeable to me. Has anyone come up with anything other than Tuple, Array, List, or Seq? Simply throwing an "s" on the end like they did with Arguments? Then we have Aliases. I doubt that that's a good idea, but it would be an option. As far as I can tell, _all_ of our options suck for one reason or another. If I had to pick, I'd pick List, simply because it's the most generic, and there won't be anyone complaining about what Seq might mean if they don't grok that it's Sequence, but it seems like no matter what we pick, there's going to be complaining. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 09:00:58 UTC, Jonathan M Davis wrote: Personally, I'd prefer List over Seq, Given that "list" has meanings other than "linked list" in several languages (Python and Racket come to mind), I don't see the problem. Perhaps someone with an extensive C or C++ background and little experience elsewhere automatically thinks "linked list", but someone coming from other languages will not. Hell, I don't really have much experiences outside of the C-family, but I don't think "linked list" when I see "list". Furthermore, even the Wikipedia article on Lists makes a distinction: "In computer science, a list or sequence is an abstract data type that represents a sequence of values, where the same value may occur more than once. An instance of a list is a computer representation of the mathematical concept of a finite sequence; the (potentially) infinite analog of a list is a stream.[1]:§3.5 Lists are a basic example of containers, as they contain other values. If the same value occurs multiple times, each occurrence is considered a distinct item. The name list is also used for several concrete data structures that can be used to implement abstract lists, especially linked lists." Given the nature of the data structure we're talking about, I think AliasList is a perfect fit. It's shorter than Sequence (the only good alternative I see atm) and List is a whole word, unlike Seq. More importantly, it's quite descriptive. Because of the baggage surrounding "tuple" in D and the use of "array" to already refer to static arrays and dynamic arrays/slices (and a data type in Phobos) I don't see either of those as viable options.
Re: Wait, what? What is AliasSeq?
I have just giggled. Wonder if there will be any proposals in this thread that haven't already been mentioned in same thread. Though now it is much more funny because you keep it renaming right in master repeating all already considered and discarded points. Sorry for being overly sarcastic, but I just can't take this seriously anymore :)
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. What happened? Why are we replacing a crappy term with another crappy term? I also saw this change and was horrified. It just replaced one bad named (Arguments) by another. I just didn't want to stir up further trouble. But now that it's on the table, here's my opinion: For me, "sequence" always reminds me of the mathematical concept, where elements are of the same type (e.g. only real numbers, but not a mixture of scalars and vectors), and usually each element has some relation to either its predecessor, or its index. This doesn't fit with TypeTuples at all. Likewise, an array (at least in D) always has exactly one element type. This doesn't apply to TypeTuples either. The name I find most fitting to describe them is "tuple". The trouble with the former name is that it implies them being a tuple of types, although they don't need to be. So IMO we just need to find a better specifier. (Personally I would be fine with "list", too, but Walter finds it misleading.) I like "AliasTuple" as suggested by Martin, although it isn't a perfect fit either when you think of `alias` template params, which don't match `int`, while `int` can be an element of a TypeTuple. Alternatively "ArgumentsTuple", or "TemplateArgumentsTuple", but the latter is too long.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 09:13:27 UTC, Jonathan M Davis wrote: Has anyone come up with anything other than Tuple, Array, List, or Seq? Simply throwing an "s" on the end like they did with Arguments? Then we have Aliases. I doubt that that's a good idea, but it would be an option. What's wrong with Aliases?
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 09:13:27 UTC, Jonathan M Davis wrote: On Wednesday, 8 July 2015 at 08:59:15 UTC, deadalnix wrote: Yeah. Every name sucks. Alias seems to solve the first half of the name reasonably well, but nothing that anyone has come up with really solves the second half. [...] Array (as Andrei has suggested) is already a very overloaded term in D, and it implies a runtime data structure, which this isn't. Certainly, when folks think of arrays, they're not going to think of anything like TypeTuple/AliasSeq. List is by far the most generic, but it doesn't imply indexability, so Walter doesn't like - though Seq doesn't imply indexability either, so if that's his complaint, I don't see how it makes much differences whether we go with List or Seq. They seem pretty interchangeable to me. [...] - Jonathan M Davis Perhaps in such case we are going to invent new word? How about a kind of portmoneu word? For example tree + heap => treap. And we can have alias+list => aliast. No one have such word before an no impure association.
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. What happened? Why are we replacing a crappy term with another crappy term? Andrei Why not just iterate over every possible candidate and vote? Anyway, here is my unordered `list`: Aliases, AliasSet, AliasList, AliasEnum, AliasRange, AliasGroup, AliasIndex, Aliases has my vote.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 09:49:59 UTC, ixid wrote: On Wednesday, 8 July 2015 at 09:13:27 UTC, Jonathan M Davis wrote: Has anyone come up with anything other than Tuple, Array, List, or Seq? Simply throwing an "s" on the end like they did with Arguments? Then we have Aliases. I doubt that that's a good idea, but it would be an option. What's wrong with Aliases? Well, it says less about what it is than something like AliasList or AliasTuple would, but it also runs afoul of the same problem that std.container.Array does. It's using the same name as something else that's commonly talked about but means something quite different (even if it's related). When folks talk about aliases right now, they do _not_ mean Aliases. They're talking about stuff like alias foo = bar; And renaming TypeTuple to Aliases is just going to increase confusion. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 14:18:20 UTC, Jonathan M Davis wrote: And renaming TypeTuple to Aliases is just going to increase confusion. - Jonathan M Davis It's basically just __VA_ARGS__ on steroids, thus 'Arguments' is good, there's precedence in C(Args).
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. What happened? Why are we replacing a crappy term with another crappy term? Andrei I reckon Collect would be a good name. It describes what you're doing: collecting some things together. Is also fits nicely with the currently private but hugely useful std.typetuple.Pack. Collect: collect things together to one symbol, but they're not bound together, they'll auto-expand if they can. Pack: pack things together, they only come apart explicitly (via .expand). The best thing about it? It doesn't say anything misleading about the contents. It also doesn't say anything confusing about runtime vs compile-time. Speaking as someone who's written ridiculous numbers of lines of code using TypeTuple and various incarnations of Pack, Collect fits my way of thinking.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 14:45:55 UTC, Xiaoxi wrote: On Wednesday, 8 July 2015 at 14:18:20 UTC, Jonathan M Davis wrote: And renaming TypeTuple to Aliases is just going to increase confusion. - Jonathan M Davis It's basically just __VA_ARGS__ on steroids, thus 'Arguments' is good, there's precedence in C(Args). LOL. Then what about when you use it for _parameters_ rather than arguments? Or when you use it areas that have _nothing_ to do with functions - e.g. foreach(S; TypeTuple!(string, char[], wstring, dstring)) { //... } Naming it Arguments gives the impression that it's specifically related to arguments, and that's just one small area that it gets used in. And that's part of what's so hard about naming it. It just does way too many things to name easily. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 16:44:13 UTC, Jonathan M Davis wrote: On Wednesday, 8 July 2015 at 14:45:55 UTC, Xiaoxi wrote: On Wednesday, 8 July 2015 at 14:18:20 UTC, Jonathan M Davis wrote: And renaming TypeTuple to Aliases is just going to increase confusion. - Jonathan M Davis It's basically just __VA_ARGS__ on steroids, thus 'Arguments' is good, there's precedence in C(Args). LOL. Then what about when you use it for _parameters_ rather than arguments? Or when you use it areas that have _nothing_ to do with functions - e.g. foreach(S; TypeTuple!(string, char[], wstring, dstring)) { //... } Naming it Arguments gives the impression that it's specifically related to arguments, and that's just one small area that it gets used in. And that's part of what's so hard about naming it. It just does way too many things to name easily. - Jonathan M Davis Not going to say if it is good or bad proposal, but your comment is not strictly relevant - template arguments are also arguments in D. It is exactly the term dlang.org grammar spec uses.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 16:29:25 UTC, John Colvin wrote: I reckon Collect would be a good name. It describes what you're doing: collecting some things together. Is also fits nicely with the currently private but hugely useful std.typetuple.Pack. Collect: collect things together to one symbol, but they're not bound together, they'll auto-expand if they can. Pack: pack things together, they only come apart explicitly (via .expand). The best thing about it? It doesn't say anything misleading about the contents. It also doesn't say anything confusing about runtime vs compile-time. Speaking as someone who's written ridiculous numbers of lines of code using TypeTuple and various incarnations of Pack, Collect fits my way of thinking. Let's choose a name the cool kids will like and name it OmniSplat.
Re: Wait, what? What is AliasSeq?
On 07/08/2015 06:44 PM, Jonathan M Davis wrote: On Wednesday, 8 July 2015 at 14:45:55 UTC, Xiaoxi wrote: On Wednesday, 8 July 2015 at 14:18:20 UTC, Jonathan M Davis wrote: And renaming TypeTuple to Aliases is just going to increase confusion. - Jonathan M Davis It's basically just __VA_ARGS__ on steroids, thus 'Arguments' is good, there's precedence in C(Args). LOL. Then what about when you use it for _parameters_ rather than arguments? Or when you use it areas that have _nothing_ to do with functions - e.g. foreach(S; TypeTuple!(string, char[], wstring, dstring)) { //... } Naming it Arguments gives the impression that it's specifically related to arguments, and that's just one small area that it gets used in. And that's part of what's so hard about naming it. It just does way too many things to name easily. - Jonathan M Davis I assume the rationale is that the thing you get is literally the arguments to the template. alias Asdf(T...)=T; Asdf!(string,char[],wstring,dstring) ^~~ Arguments It's the identity function on template argument lists. This is needed because those do not have their own syntax.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 17:15:50 UTC, Timon Gehr wrote: On 07/08/2015 06:44 PM, Jonathan M Davis wrote: On Wednesday, 8 July 2015 at 14:45:55 UTC, Xiaoxi wrote: On Wednesday, 8 July 2015 at 14:18:20 UTC, Jonathan M Davis wrote: And renaming TypeTuple to Aliases is just going to increase confusion. - Jonathan M Davis It's basically just __VA_ARGS__ on steroids, thus 'Arguments' is good, there's precedence in C(Args). LOL. Then what about when you use it for _parameters_ rather than arguments? Or when you use it areas that have _nothing_ to do with functions - e.g. foreach(S; TypeTuple!(string, char[], wstring, dstring)) { //... } Naming it Arguments gives the impression that it's specifically related to arguments, and that's just one small area that it gets used in. And that's part of what's so hard about naming it. It just does way too many things to name easily. - Jonathan M Davis I assume the rationale is that the thing you get is literally the arguments to the template. alias Asdf(T...)=T; Asdf!(string,char[],wstring,dstring) ^~~ Arguments It's the identity function on template argument lists. This is needed because those do not have their own syntax. Sure, but they could also represent a template's parameters, not just the arguments. It all depends on what you're using the TypeTuple for. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 17:09:14 UTC, Dicebot wrote: On Wednesday, 8 July 2015 at 16:44:13 UTC, Jonathan M Davis wrote: Naming it Arguments gives the impression that it's specifically related to arguments, and that's just one small area that it gets used in. And that's part of what's so hard about naming it. It just does way too many things to name easily. - Jonathan M Davis Not going to say if it is good or bad proposal, but your comment is not strictly relevant - template arguments are also arguments in D. It is exactly the term dlang.org grammar spec uses. Yes, but TypeTuple isn't just used for template arguments - or function arguments. In other circumstances, it's used for parameters or even for stuff that has nothing to do with either - e.g. in a foreach loop. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 17:21:06 UTC, Jonathan M Davis wrote: Sure, but they could also represent a template's parameters, not just the arguments. It all depends on what you're using the TypeTuple for. No matter what they represent, they ARE template arguments. That is a simple identity, as Timon has mentioned. Your reasoning is similar to saying that variables shouldn't be called variables because they can be immutable (not necessarily immutable in language terms but logically). Trying to name argument lists by their usage pattern is doomed from the very beginning because they have many absolutely unrelated applications.
Re: Wait, what? What is AliasSeq?
On 07/08/2015 11:38 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= " wrote: I like "AliasTuple" as suggested by Martin, although it isn't a perfect fit either when you think of `alias` template params, which don't match `int`, while `int` can be an element of a TypeTuple. But this works: alias Int = int; The right fix for this issue is to fix the language. This does not make any sense.
Re: Wait, what? What is AliasSeq?
On 7/8/15 5:49 AM, ixid wrote: On Wednesday, 8 July 2015 at 09:13:27 UTC, Jonathan M Davis wrote: Has anyone come up with anything other than Tuple, Array, List, or Seq? Simply throwing an "s" on the end like they did with Arguments? Then we have Aliases. I doubt that that's a good idea, but it would be an option. What's wrong with Aliases? It's plural. How to talk about Aliases? That was my main issue with Arguments. "use a TypeTuple" -> "use an Aliases" -Steve
Re: Wait, what? What is AliasSeq?
On 7/8/15 1:44 PM, Timon Gehr wrote: On 07/08/2015 11:38 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= " wrote: I like "AliasTuple" as suggested by Martin, although it isn't a perfect fit either when you think of `alias` template params, which don't match `int`, while `int` can be an element of a TypeTuple. But this works: alias Int = int; The right fix for this issue is to fix the language. This does not make any sense. Yes, Walter at dconf also (I think) agreed this at least needs to be fixed: alias Int = int; template T(alias X) { enum a = 1;} int x = T!Int.a; // error In addition, this doesn't work: alias foo = 2; But this does: int x = T!2.a; I think alias should be the same anywhere you use it. And Aliasterm here> for a name for what TypeTuple/Arguments/AliasSeq is, seems like an appropriate name given how template aliases work. Not my favorite, but it's at least based in logic. -Steve
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 17:53:05 UTC, Steven Schveighoffer wrote: It's plural. How to talk about Aliases? That was my main issue with Arguments. "use a TypeTuple" -> "use an Aliases" -Steve "use Aliases" or "use the Aliases". I'm not arguing for Aliases but that seems like a non-problem. If something more general is required then Terms or something like that.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 18:01:36 UTC, Steven Schveighoffer wrote: On 7/8/15 1:44 PM, Timon Gehr wrote: On 07/08/2015 11:38 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= " wrote: I like "AliasTuple" as suggested by Martin, although it isn't a perfect fit either when you think of `alias` template params, which don't match `int`, while `int` can be an element of a TypeTuple. But this works: alias Int = int; The right fix for this issue is to fix the language. This does not make any sense. Yes, Walter at dconf also (I think) agreed this at least needs to be fixed: alias Int = int; template T(alias X) { enum a = 1;} int x = T!Int.a; // error In addition, this doesn't work: alias foo = 2; But this does: int x = T!2.a; I think alias should be the same anywhere you use it. And Alias for a name for what TypeTuple/Arguments/AliasSeq is, seems like an appropriate name given how template aliases work. Not my favorite, but it's at least based in logic. -Steve Yes, yes, yes, 20 times yes. There are some quirks with what can be aliased depending on how the alias is declared, this needs to be unified. The thing we are naming here is some collection of aliases. Talking to everybody, the 2 names that came up frequently for this collection are List and Sequence. I personally don't mind, but Walter had strong views against List, so I went for Sequence. Now we should decide for a term for this entity we have in D that is kind of tuple but auto unpack. This construct does not exists in other languages, so, as explained by Jonathan, no existing name will fit 100% . I'd say we pick some name that evoke an ordered collection and that which is not already used for some existing construct in D (which rules out array for instance) or have a well defined meaning (like tuple). Sequence fit the bill. I don't mind using another name that fit the bill as well. Nobody came up with that name yet.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 18:01:36 UTC, Steven Schveighoffer wrote: In addition, this doesn't work: alias foo = 2; I think you are right that that should be allowed, but just out of curiosity, if that was allowed, then what would the purpose of enum be?
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 20:14:55 UTC, Tofu Ninja wrote: On Wednesday, 8 July 2015 at 18:01:36 UTC, Steven Schveighoffer wrote: In addition, this doesn't work: alias foo = 2; I think you are right that that should be allowed, but just out of curiosity, if that was allowed, then what would the purpose of enum be? enum has all kind of bizare rules for arrays for instance. I'm not sure how justified it is to begin with, but that it is in and everybody uses them enum has its place is there to stay.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 20:11:16 UTC, deadalnix wrote: Sequence fit the bill. I don't mind using another name that fit the bill as well. Nobody came up with that name yet. I find that naming objects is a key part of programming, and to that end I own one copy of Roget's International Thesaurus (Crowell, 4th edition -- a quality thesaurus, not a cheap junk book) at work, and another copy that I keep at home. It's the best reference I know of to jog your thinking out of a rut when you need some synonym that is just beyond your mental reach. Looking up the concept in this case yields words like "series", "chain", and "train". There are lots more choices, but those are some of the simple, short ones. So we could have AliasSeries or SerialAliases, AliasChain, etc. I'm not saying I'm in favor of any of these in particular, or that I'm at all familiar with the underlying idea we're trying to name here; all I'm proposing is a process for generating alternative names.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 22:01:48 UTC, Observer wrote: I find that naming objects is a key part of programming, and to that end I own one copy of Roget's International Thesaurus (Crowell, 4th edition -- a quality thesaurus, not a cheap junk book) at work, and another copy that I keep at home. It's the best reference I know of to jog your thinking out of a rut when you need some synonym that is just beyond your mental reach. Thats actually a pretty neat idea, I feel like I am going to start doing this when I have trouble naming things.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 09:25:19 UTC, Mike Parker wrote: On Wednesday, 8 July 2015 at 09:00:58 UTC, Jonathan M Davis wrote: Personally, I'd prefer List over Seq, Given that "list" has meanings other than "linked list" in several languages (Python and Racket come to mind), I don't see the problem. Yep C# too: List is arguably the most used collection in the language, and it's indexable and not linked. "In computer science, a list or sequence is an abstract data type that represents a sequence of values, where the same value may occur more than once. An instance of a list is a computer representation of the mathematical concept of a finite sequence; the (potentially) infinite analog of a list is a stream.[1]:§3.5 Lists are a basic example of containers, as they contain other values. If the same value occurs multiple times, each occurrence is considered a distinct item. The name list is also used for several concrete data structures that can be used to implement abstract lists, especially linked lists." Given the nature of the data structure we're talking about, I think AliasList is a perfect fit. It's shorter than Sequence (the only good alternative I see atm) and List is a whole word, unlike Seq. More importantly, it's quite descriptive. Because of the baggage surrounding "tuple" in D and the use of "array" to already refer to static arrays and dynamic arrays/slices (and a data type in Phobos) I don't see either of those as viable options. Yep, I totally agree. The term "list" largely depends on context, but even in the software development domain it can be interpreted analagously to "grocery list" or "todo list". Vetoing AliasList leaves us with nothing good.
Re: Wait, what? What is AliasSeq?
On 7/8/2015 2:00 AM, Jonathan M Davis wrote: On Tuesday, 7 July 2015 at 22:22:02 UTC, Walter Bright wrote: On 7/7/2015 2:20 PM, David Nadlinger wrote: On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. Apparently Walter was opposed to using List, as that would somehow imply "linked list". I opposed it because lists are not indexable, and tuples are. Linked lists are not indexable, but the term list doesn't necessarily imply that it's a linked list. It does to me, and in common programming usage "list" is often said instead of "linked list". As for Seq, it's kind of ugly, but if understand that it's Sequence, I think that that fits well enough. Personally, I'd prefer List over Seq, but if you're vetoing List, then I don't know what else we're going to go with. _Nothing_ fits perfectly. TypeTuple/AliasSeq/Whatever is just too unique and too much of a hodgepodge for any name to really well. Which is why I simply picked the name Arguments. The s suffix means plural, and doesn't give any preconceived notion about what kind of collection it is. It's a convention I've been using in the dmd source for some time now, and have found it to be natural and pleasing.
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 00:11:17 UTC, Walter Bright wrote: It does to me, and in common programming usage "list" is often said instead of "linked list". There seems to be a lot of languages that make lists indexable... And the definition of what a list is seems to vary quite a lot. Languages with something called a list that is indexable... Java C# Python Perl
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 00:48:40 UTC, Tofu Ninja wrote: Languages with something called a list that is indexable... Java C# Python Perl Tcl (lists are an absolutely fundamental part of this language) Lisp Haskell Icon
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 00:11:17 UTC, Walter Bright wrote: Which is why I simply picked the name Arguments. The s suffix means plural, and doesn't give any preconceived notion about what kind of collection it is. It's a convention I've been using in the dmd source for some time now, and have found it to be natural and pleasing. Instead, it gives the idea that they're used specifically for arguments, which they aren't. They get used for a variety of things. Also, the term Arguments is going to be really confusing - just like talking about std.container.Array gets confusing, because the term array is already used for other stuff, and it's never clear what folks are talking about unless they get specific. At least when you use the term TypeTuple, everyone knows what you mean, even if it's a sucky name. Going with something like Arguments or Parameters or Aliases is just going to breed confusion. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On 7/8/2015 7:22 PM, Jonathan M Davis wrote: On Thursday, 9 July 2015 at 00:11:17 UTC, Walter Bright wrote: Which is why I simply picked the name Arguments. The s suffix means plural, and doesn't give any preconceived notion about what kind of collection it is. It's a convention I've been using in the dmd source for some time now, and have found it to be natural and pleasing. Instead, it gives the idea that they're used specifically for arguments, which they aren't. They get used for a variety of things. Also, the term Arguments is going to be really confusing - just like talking about std.container.Array gets confusing, because the term array is already used for other stuff, and it's never clear what folks are talking about unless they get specific. At least when you use the term TypeTuple, everyone knows what you mean, even if it's a sucky name. Going with something like Arguments or Parameters or Aliases is just going to breed confusion. What about the 's' suffix?
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 02:58:32 UTC, Walter Bright wrote: On 7/8/2015 7:22 PM, Jonathan M Davis wrote: On Thursday, 9 July 2015 at 00:11:17 UTC, Walter Bright wrote: Which is why I simply picked the name Arguments. The s suffix means plural, and doesn't give any preconceived notion about what kind of collection it is. It's a convention I've been using in the dmd source for some time now, and have found it to be natural and pleasing. Instead, it gives the idea that they're used specifically for arguments, which they aren't. They get used for a variety of things. Also, the term Arguments is going to be really confusing - just like talking about std.container.Array gets confusing, because the term array is already used for other stuff, and it's never clear what folks are talking about unless they get specific. At least when you use the term TypeTuple, everyone knows what you mean, even if it's a sucky name. Going with something like Arguments or Parameters or Aliases is just going to breed confusion. What about the 's' suffix? It might work in a situation where the main word is clearly unique, but when you're talking about something like Argument or Alias, adding an s on the end does not help at all. It's far too easy to confuse it with other concepts in the language that have the same name, whereas putting something like List on the end wouldn't have that problem - e.g. no one is going to confuse AliasList for anything else, but if we had Aliases, it would be really easy to think that someone was referring to aliases like this alias foo = bar; and misunderstand what they were talking about - especially in verbal conversations. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 03:31:41 UTC, Jonathan M Davis wrote: alias foo = bar; and misunderstand what they were talking about - especially in verbal conversations. - Jonathan M Davis Maybe with time, people will learn to use d:s module system verbally and say things like " meta pack" when referring to meta.Pack etc.
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 00:11:17 UTC, Walter Bright wrote: Which is why I simply picked the name Arguments. The s suffix means plural, and doesn't give any preconceived notion about what kind of collection it is. It's a convention I've been using in the dmd source for some time now, and have found it to be natural and pleasing. +1 -- Paolo
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 01:26:57 UTC, Observer wrote: On Thursday, 9 July 2015 at 00:48:40 UTC, Tofu Ninja wrote: Languages with something called a list that is indexable... Java C# Python Perl Tcl (lists are an absolutely fundamental part of this language) Lisp Haskell Icon Several of which actually use linked list for list and probably shouldn't provide random access.
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 02:58:32 UTC, Walter Bright wrote: What about the 's' suffix? I use it for collection names quite a lot. Like: Foo[] foos; But I wouldn't go for alias Foos = Foo[]; Additionally, we have this language concept that is autounpacking and so on and have no name. It needs a name. This construct does not exists in most languages, so we need to come up with a name.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 18:01:36 UTC, Steven Schveighoffer wrote: On 7/8/15 1:44 PM, Timon Gehr wrote: On 07/08/2015 11:38 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= " wrote: I like "AliasTuple" as suggested by Martin, although it isn't a perfect fit either when you think of `alias` template params, which don't match `int`, while `int` can be an element of a TypeTuple. But this works: alias Int = int; The right fix for this issue is to fix the language. This does not make any sense. Of course, but I thought that was out of question. However... Yes, Walter at dconf also (I think) agreed this at least needs to be fixed: ... that's nice to hear! Then I think we should definitely go with "AliasTuple".
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 08:03:06 UTC, deadalnix wrote: [..] Additionally, we have this language concept that is autounpacking and so on and have no name. It needs a name. [..] Unrolling?
Re: Wait, what? What is AliasSeq?
On 7/8/15 2:22 PM, ixid wrote: On Wednesday, 8 July 2015 at 17:53:05 UTC, Steven Schveighoffer wrote: It's plural. How to talk about Aliases? That was my main issue with Arguments. "use a TypeTuple" -> "use an Aliases" -Steve "use Aliases" or "use the Aliases". I'm not arguing for Aliases but that seems like a non-problem. If something more general is required then Terms or something like that. It still doesn't read correctly. I'll give you an example from std.meta:https://github.com/D-Programming-Language/phobos/blob/master/std/meta.d#L146 "Returns a typetuple created from TList with the first occurrence, if any, of T removed." Possible options: "Returns Aliases created from TList with the first occurrence, if any, of T removed." "Returns the Aliases created from TList with the first occurrence, if any, of T removed." "Returns an instance of Aliases created from TList with the first occurrence, if any, of T removed." I don't like them. However, use AliasSeq: "Returns an AliasSeq created from TList with the first occurrence, if any, of T removed." The difference is subtle, but definitely clearer and less awkward. BTW, others have argued that typetuple above doesn't refer to the TypeTuple type, but the actual typetuple concept as described in the spec (a tuple of types). However, in this case, TList doesn't have to be strictly types, so this is not correct. So this should be changed. The more I think about this, I think AliasTuple is probably the best answer. We have "type tuples" and "value tuples", "alias tuples" seems like a natural fit. -Steve
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 11:34:56 UTC, Steven Schveighoffer wrote: The more I think about this, I think AliasTuple is probably the best answer. We have "type tuples" and "value tuples", "alias tuples" seems like a natural fit. -Steve As we already have two tuples wouldn't a third be a bad idea for clarity or do you consider this meaning to overlap with the previous two?
Re: Wait, what? What is AliasSeq?
On 7/8/15 4:14 PM, Tofu Ninja wrote: On Wednesday, 8 July 2015 at 18:01:36 UTC, Steven Schveighoffer wrote: In addition, this doesn't work: alias foo = 2; I think you are right that that should be allowed, but just out of curiosity, if that was allowed, then what would the purpose of enum be? Alias literally means "another name for". enum, used in this context, means "manifest constant value of". Both descriptions can be applied to 2 (or any other literal) and reduce to the same effect, but when you start getting into non-literals, the meaning doesn't match: int foo(); alias x = foo; // using x means to call foo enum x = foo; // x is an enum int assigned the value of foo() evaluated at compile time -Steve
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 11:34:56 UTC, Steven Schveighoffer wrote: "Returns Aliases created from TList with the first occurrence, if any, of T removed." "Returns the Aliases created from TList with the first occurrence, if any, of T removed." "Returns an instance of Aliases created from TList with the first occurrence, if any, of T removed." I don't like them. Hmm. I can't find anything misleading or arkward about them. Sounds pretty natural to me.
Re: Wait, what? What is AliasSeq?
On 7/9/15 4:54 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= " wrote: On Wednesday, 8 July 2015 at 18:01:36 UTC, Steven Schveighoffer wrote: On 7/8/15 1:44 PM, Timon Gehr wrote: On 07/08/2015 11:38 AM, "Marc =?UTF-8?B?U2Now7x0eiI=?= " wrote: I like "AliasTuple" as suggested by Martin, although it isn't a perfect fit either when you think of `alias` template params, which don't match `int`, while `int` can be an element of a TypeTuple. But this works: alias Int = int; The right fix for this issue is to fix the language. This does not make any sense. Of course, but I thought that was out of question. However... Yes, Walter at dconf also (I think) agreed this at least needs to be fixed: that's nice to hear! After the last talk (I think) David Nadlinger went around with a hand-written piece of code that did something similar to what I wrote and asked everyone whether it should compile or not. Both Walter and I said it should (I thought alias works as long as you are passing a *symbol* and not a keyword, and Int is a symbol). But it doesn't because T!(Int) and T!(int) are considered the same template instantiation. Only I think 2 people correctly realized it was currently invalid. Taking a look through phobos, you will see all kinds of duplicate templates, one that is SomeTemplate(alias T) and one that is SomeTemplate(T) (which do the same thing), just for this limitation. I think it's a huge waste of code space and mental confusion. Then I think we should definitely go with "AliasTuple". Yeah, I have been thinking AliasTuple is likely the best name. It goes right along with "type tuple" and "expression tuple". If we were designing from scratch, I'd say this thing is called Tuple, and std.typecons.Tuple would be ExpressionTuple. -Steve
Re: Wait, what? What is AliasSeq?
On 7/8/15 8:11 PM, Walter Bright wrote: Which is why I simply picked the name Arguments. The s suffix means plural, and doesn't give any preconceived notion about what kind of collection it is. It's a convention I've been using in the dmd source for some time now, and have found it to be natural and pleasing. It's not always plural (e.g. Arguments!(int)). And being plural doesn't lend itself well to documentation. When you want to define some finite things, you usually wrap that into a construct (collection, set, group, sequence, list, etc). It's much more natural to talk about a list of arguments or a list of aliases, than it is to talk about arguments (which imply you mean all arguments, or arguments as a classification). -Steve
Re: Wait, what? What is AliasSeq?
On 7/9/15 7:41 AM, ixid wrote: On Thursday, 9 July 2015 at 11:34:56 UTC, Steven Schveighoffer wrote: The more I think about this, I think AliasTuple is probably the best answer. We have "type tuples" and "value tuples", "alias tuples" seems like a natural fit. As we already have two tuples wouldn't a third be a bad idea for clarity or do you consider this meaning to overlap with the previous two? It is overlapping. A type tuple and an expression tuple are both sub-classifications of an alias tuple. If we could start over, we should really just name this Tuple. -Steve
Re: Wait, what? What is AliasSeq?
On 07/08/2015 08:01 PM, Steven Schveighoffer wrote: Yes, Walter at dconf also (I think) agreed this at least needs to be fixed: alias Int = int; template T(alias X) { enum a = 1;} int x = T!Int.a; // error There should be no difference between Int and int after the alias declaration. The "symbol" vs. "non-symbol" distinction is arbitrary and does not buy anything.
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 22:01:48 UTC, Observer wrote: all I'm proposing is a process for generating alternative names. AliasBall, AliasPile, AliasGroup, AliasSet, AliasLine... (That is, I generally agree inventing a new term that fits isn't a bad idea.) -Wyatt
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 13:47:58 UTC, Wyatt wrote: On Wednesday, 8 July 2015 at 22:01:48 UTC, Observer wrote: all I'm proposing is a process for generating alternative names. AliasBall, AliasPile, AliasGroup, AliasSet, AliasLine... (That is, I generally agree inventing a new term that fits isn't a bad idea.) -Wyatt Sequence is not commonly used in D so far and many used it in the past (most commonly used where List and Sequence). These term are fine, for the most part, but none of them is any better than sequence.
Re: Wait, what? What is AliasSeq?
It is a compiletime tuple so i'd vote for: CtTuple
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 14:29:55 UTC, Zoadian wrote: It is a compiletime tuple so i'd vote for: CtTuple Too bad it is not a tuple and it is not exclusively compile time. Otherwise, that'd be a great name.
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 15:03:25 UTC, deadalnix wrote: On Thursday, 9 July 2015 at 14:29:55 UTC, Zoadian wrote: It is a compiletime tuple so i'd vote for: CtTuple Too bad it is not a tuple and it is not exclusively compile time. Otherwise, that'd be a great name. Really? Proof to the contrary: it cant be indexed without first being copied into a runtime construct, its as much compiletime only as UDAs are. alias Tuple(Args...) = Args; int main(string args[]) { return Tuple!(1,2)[args.length]; }
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 15:03:25 UTC, deadalnix wrote: On Thursday, 9 July 2015 at 14:29:55 UTC, Zoadian wrote: It is a compiletime tuple so i'd vote for: CtTuple Too bad it is not a tuple [...] Quoting from https://en.wikipedia.org/wiki/Tuple : A tuple is a finite ordered list of elements. - finite: check - ordered: check - list of elements: check Fits perfectly. Interestingly, it goes on by saying: An n-tuple is defined inductively using the construction of an ordered pair. Although not stated explicitly, this implies (a kind of) auto expanding! => Fits more than perfectly :-P
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 18:45:56 UTC, Marc Schütz wrote: Interestingly, it goes on by saying: An n-tuple is defined inductively using the construction of an ordered pair. Although not stated explicitly, this implies (a kind of) auto expanding! => Fits more than perfectly :-P No one who has ever seriously used tuples in any programming language I've ever heard of would expect tuples to auto expand. Auto expansion makes them _considerably_ less useful. In the case of TypeTuple/AliasSeq, the situation is a bit different, because we're not really talking about tuples here. Real tuples nest, and they don't auto expand. TypeTuple/AliasSeq is the _only_ case I've ever seen where someone tried to claim that something was a tuple when it didn't nest, or it auto-expanded. Folks have been consistently confused about the differences between TypeTuple and std.typecons.Tuple and the fact that TypeTuples auto expand. No one expects it - because tuples just don't do that in any actual programming languages. I question the validity of your interpretation of the theory as well, but even if it's valid, it doesn't match what's done in actual programming languages. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On 7/9/2015 12:56 AM, deadalnix wrote: Several of which actually use linked list for list and probably shouldn't provide random access. Yes. Consider: for (int i = 0; i < list.length; ++i) sum += list[i]; If indexing was allowed on a list, this would seem like perfectly reasonable code.
Re: Wait, what? What is AliasSeq?
On Thu, Jul 09, 2015 at 07:10:38PM +, Jonathan M Davis via Digitalmars-d wrote: > On Thursday, 9 July 2015 at 18:45:56 UTC, Marc Schütz wrote: > >Interestingly, it goes on by saying: > > > >>An n-tuple is defined inductively using the construction > >>of an ordered pair. > > > >Although not stated explicitly, this implies (a kind of) auto > >expanding! => Fits more than perfectly :-P > > No one who has ever seriously used tuples in any programming language > I've ever heard of would expect tuples to auto expand. Auto expansion > makes them _considerably_ less useful. FWIW, Perl arrays auto-expand (or more precisely, auto-denest), unless you force them not to by taking a reference to the subarray instead. I'm not sure if this behaviour has changed in the newest version of Perl, but it was the cause of much confusion to new learners. Not the same thing as tuples, I know, but somebody *did* propose the name "array" for D's auto-expanding whatchamacallit. T -- Curiosity kills the cat. Moral: don't be the cat.
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 19:10:39 UTC, Jonathan M Davis wrote: On Thursday, 9 July 2015 at 18:45:56 UTC, Marc Schütz wrote: Interestingly, it goes on by saying: An n-tuple is defined inductively using the construction of an ordered pair. Although not stated explicitly, this implies (a kind of) auto expanding! => Fits more than perfectly :-P No one who has ever seriously used tuples in any programming language I've ever heard of would expect tuples to auto expand. You're right. And after all of the discussion, I like the name AliasSeq more. The fact that it sometimes elicits a 'WTF' reaction is perfect; it's a D thing (or a 'not normally exposed to the programmer thing') so you need to look up what it does. Using Tuple, List, or Array in the name is unhelpful, as those names are used a lot already.
Re: Wait, what? What is AliasSeq?
On 7/7/15, Andrei Alexandrescu via Digitalmars-d wrote: > So I thought we were supposed to replace bad names with good names. > Template arguments are indexable, so "sequence" doesn't quite apply. > > What happened? Why are we replacing a crappy term with another crappy term? > > > Andrei > As far as I can tell there's a giant elephant in the room and his name is `Tuple`. The problem is there's a Tuple template in Phobos. If you rename that you get a solid new name for a language tuple. /mytwocents
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 19:19:42 UTC, Walter Bright wrote: On 7/9/2015 12:56 AM, deadalnix wrote: Several of which actually use linked list for list and probably shouldn't provide random access. Yes. Consider: for (int i = 0; i < list.length; ++i) sum += list[i]; If indexing was allowed on a list, this would seem like perfectly reasonable code. In many languages that is perfectly reasonable because list does not equal linked list. Its almost as if a list is an abstract concept and does not mean any one definite data structure, hmmm who wuda thunk that...
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 19:19:42 UTC, Walter Bright wrote: On 7/9/2015 12:56 AM, deadalnix wrote: Several of which actually use linked list for list and probably shouldn't provide random access. Yes. Consider: for (int i = 0; i < list.length; ++i) sum += list[i]; If indexing was allowed on a list, this would seem like perfectly reasonable code. Yes, which is why it's so ridiculous that the List interface in Java provides indexing via the at function. Both ArrayList and LinkedList implement it, which is reasonable in the case of ArrayList and stupid in the case of LinkedList. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 20:57:54 UTC, Tofu Ninja wrote: On Thursday, 9 July 2015 at 19:19:42 UTC, Walter Bright wrote: On 7/9/2015 12:56 AM, deadalnix wrote: Several of which actually use linked list for list and probably shouldn't provide random access. Yes. Consider: for (int i = 0; i < list.length; ++i) sum += list[i]; If indexing was allowed on a list, this would seem like perfectly reasonable code. In many languages that is perfectly reasonable because list does not equal linked list. Its almost as if a list is an abstract concept and does not mean any one definite data structure, hmmm who wuda thunk that... It's definitely true that the term list does not denote a particular data structure in computer science, so I disagree with Walter's reticence to use the term list with AliasList, but it's also true that some languages and libraries have stupidly put indexing on a linked list, which is what deadalnix was complaining about. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 19:45:21 UTC, Brian Rogoff wrote: And after all of the discussion, I like the name AliasSeq more. The fact that it sometimes elicits a 'WTF' reaction is perfect; it's a D thing (or a 'not normally exposed to the programmer thing') so you need to look up what it does. Using Tuple, List, or Array in the name is unhelpful, as those names are used a lot already. Yeah. Arguably going with a weirder name has the advantage of making it so that you're less likely to assume that you understand it when you see it (since if you haven't studied up on it, you _don't_ understand it), whereas the other terms - especially Tuple - tend to make folks assume that they understand it when they really don't. No one understands TypeTuples/AliasSeqs without studying up on them. They're just too unique. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Wednesday, 8 July 2015 at 16:44:13 UTC, Jonathan M Davis wrote: On Wednesday, 8 July 2015 at 14:45:55 UTC, Xiaoxi wrote: On Wednesday, 8 July 2015 at 14:18:20 UTC, Jonathan M Davis wrote: And renaming TypeTuple to Aliases is just going to increase confusion. - Jonathan M Davis It's basically just __VA_ARGS__ on steroids, thus 'Arguments' is good, there's precedence in C(Args). LOL. Then what about when you use it for _parameters_ rather than arguments? Or when you use it areas that have _nothing_ to do with functions - e.g. foreach(S; TypeTuple!(string, char[], wstring, dstring)) { //... } Naming it Arguments gives the impression that it's specifically related to arguments, and that's just one small area that it gets used in. And that's part of what's so hard about naming it. It just does way too many things to name easily. - Jonathan M Davis You just made the argument for calling it Arguments by arguing against its name being Arguments. arguments and parameters are both basically the same thing and so is the example where you use it as the arguments to a foreach loop. Most of the suggestions are too low level, fact is its a Tuple :D
Re: Wait, what? What is AliasSeq?
On Thursday, 9 July 2015 at 19:10:39 UTC, Jonathan M Davis wrote: On Thursday, 9 July 2015 at 18:45:56 UTC, Marc Schütz wrote: Interestingly, it goes on by saying: An n-tuple is defined inductively using the construction of an ordered pair. Although not stated explicitly, this implies (a kind of) auto expanding! => Fits more than perfectly :-P No one who has ever seriously used tuples in any programming language I've ever heard of would expect tuples to auto expand. Auto expansion makes them _considerably_ less useful. In the case of TypeTuple/AliasSeq, the situation is a bit different, because we're not really talking about tuples here. Real tuples nest, and they don't auto expand. But my quote above that they _don't_ nest and _do_ auto-expand, how else could you construct n-tuples from pairs? TypeTuple/AliasSeq is the _only_ case I've ever seen where someone tried to claim that something was a tuple when it didn't nest, or it auto-expanded. Folks have been consistently confused about the differences between TypeTuple and std.typecons.Tuple and the fact that TypeTuples auto expand. No one expects it - because tuples just don't do that in any actual programming languages. I question the validity of your interpretation of the theory as well, but even if it's valid, it doesn't match what's done in actual programming languages. I personally think this auto-expanding argument is overrated. I don't have any particular expectation regarding auto-expansion towards the concept "tuple". Sure, it may be surprising, but that doesn't stop an auto expanding tuple from being a tuple, just like Perl arrays being auto-expanding doesn't stop them from being arrays.
Re: Wait, what? What is AliasSeq?
On Friday, 10 July 2015 at 08:37:56 UTC, Marc Schütz wrote: I personally think this auto-expanding argument is overrated. I don't have any particular expectation regarding auto-expansion towards the concept "tuple". But he's right that we have auto-expanding and non-expanding tuples, so having a different term for the auto-expanding one would help a bit.
Re: Wait, what? What is AliasSeq?
On Friday, 10 July 2015 at 08:42:44 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 08:37:56 UTC, Marc Schütz wrote: I personally think this auto-expanding argument is overrated. I don't have any particular expectation regarding auto-expansion towards the concept "tuple". But he's right that we have auto-expanding and non-expanding tuples, so having a different term for the auto-expanding one would help a bit. Only minimally. We also have different kinds of ranges, but their names are all just "XxxRange". I can of course only speak for myself, but having a `Tuple` and an `AliasTuple`, one auto-expanding and the other not, doesn't confuse me.
Re: Wait, what? What is AliasSeq?
On Friday, 10 July 2015 at 08:42:44 UTC, Martin Nowak wrote: But he's right that we have auto-expanding and non-expanding tuples, so having a different term for the auto-expanding one would help a bit. This unpacking is called splatting in some other PLs that have a splat operator. Maybe we can use that to describe the unpackedness, e.g. AliasSplat.
Re: Wait, what? What is AliasSeq?
On Friday, 10 July 2015 at 08:37:56 UTC, Marc Schütz wrote: I personally think this auto-expanding argument is overrated. I don't have any particular expectation regarding auto-expansion towards the concept "tuple". Sure, it may be surprising, but that doesn't stop an auto expanding tuple from being a tuple, just like Perl arrays being auto-expanding doesn't stop them from being arrays. You know there a thing scientific do that is called experiment. In this case the experiment of calling this a tuple has been made, and it confused the hell out of everybody for years. You can argue against reality all you want. The fact is, people expect tuples to not autoexpand.
Re: Wait, what? What is AliasSeq?
On Friday, 10 July 2015 at 09:05:10 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 08:42:44 UTC, Martin Nowak wrote: But he's right that we have auto-expanding and non-expanding tuples, so having a different term for the auto-expanding one would help a bit. This unpacking is called splatting in some other PLs that have a splat operator. Maybe we can use that to describe the unpackedness, e.g. AliasSplat. http://www.infoq.com/presentations/functional-pros-cons
Re: Wait, what? What is AliasSeq?
On Friday, 10 July 2015 at 10:05:19 UTC, deadalnix wrote: On Friday, 10 July 2015 at 08:37:56 UTC, Marc Schütz wrote: I personally think this auto-expanding argument is overrated. I don't have any particular expectation regarding auto-expansion towards the concept "tuple". Sure, it may be surprising, but that doesn't stop an auto expanding tuple from being a tuple, just like Perl arrays being auto-expanding doesn't stop them from being arrays. You know there a thing scientific do that is called experiment. In this case the experiment of calling this a tuple has been made, and it confused the hell out of everybody for years. You can argue against reality all you want. The fact is, people expect tuples to not autoexpand. the reason tuple was confusing is because it's already used by another completely distinct type.
Re: Wait, what? What is AliasSeq?
On Friday, 10 July 2015 at 09:05:10 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 08:42:44 UTC, Martin Nowak wrote: But he's right that we have auto-expanding and non-expanding tuples, so having a different term for the auto-expanding one would help a bit. This unpacking is called splatting in some other PLs that have a splat operator. Maybe we can use that to describe the unpackedness, e.g. AliasSplat. http://www.infoq.com/presentations/functional-pros-cons
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. What happened? Why are we replacing a crappy term with another crappy term? Andrei Well, if alias Identity(T) = T; then alias Identities(T...) = T; or just make alias Identity(T...) = T;
Re: Wait, what? What is AliasSeq?
On Friday, 10 July 2015 at 09:05:10 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 08:42:44 UTC, Martin Nowak wrote: But he's right that we have auto-expanding and non-expanding tuples, so having a different term for the auto-expanding one would help a bit. This unpacking is called splatting in some other PLs that have a splat operator. Maybe we can use that to describe the unpackedness, e.g. AliasSplat. You know what, I in fact start to like splat. This convey exactly what this is and is already used in the same way in other area of programming.
Re: Wait, what? What is AliasSeq?
On Monday, 13 July 2015 at 14:24:23 UTC, deadalnix wrote: On Friday, 10 July 2015 at 09:05:10 UTC, Martin Nowak wrote: On Friday, 10 July 2015 at 08:42:44 UTC, Martin Nowak wrote: But he's right that we have auto-expanding and non-expanding tuples, so having a different term for the auto-expanding one would help a bit. This unpacking is called splatting in some other PLs that have a splat operator. Maybe we can use that to describe the unpackedness, e.g. AliasSplat. You know what, I in fact start to like splat. This convey exactly what this is and is already used in the same way in other area of programming. Is the inverse a squidge?
Re: Wait, what? What is AliasSeq?
On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. What happened? Why are we replacing a crappy term with another crappy term? Andrei Splat ? Would that work ?
Re: Wait, what? What is AliasSeq?
On Monday, 13 July 2015 at 22:08:27 UTC, deadalnix wrote: On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. What happened? Why are we replacing a crappy term with another crappy term? Andrei Splat ? Would that work ? Um. Seriously? I don't see how that would result in anything but ridicule. What's D do? It goes splat. - Jonathan M Davis
Re: Wait, what? What is AliasSeq?
On Monday, 13 July 2015 at 22:08:27 UTC, deadalnix wrote: On Tuesday, 7 July 2015 at 21:15:40 UTC, Andrei Alexandrescu wrote: So I thought we were supposed to replace bad names with good names. Template arguments are indexable, so "sequence" doesn't quite apply. What happened? Why are we replacing a crappy term with another crappy term? Andrei Splat ? Would that work ? Do you really think Splat is better than the other suggestions in this thread. I really don't want to have to start writing Splat all over my code, just feels dirty...
Re: Wait, what? What is AliasSeq?
On Monday, 13 July 2015 at 22:08:27 UTC, deadalnix wrote: Splat ? Would that work ? No. Just make it AliasList and call it a day. "List" does not mean unindexable linked list except in the minds of a few.