Wait, what? What is AliasSeq?

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 8 02:25:15 PDT 2015


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.


More information about the Digitalmars-d mailing list