Should we rename Deque?

Deque is a rather silly name -- and it's even sillier that it needs to come with a pronunciation guide.

People seem to be split into two camps about it: "d.q." and "deck" are both popular, and in fact "d.q." might be the usual way to say it. Just look at these three Twitter polls:

@Litherum: "d.q.": 62.5%, "deck": 37.5% (40 votes)
@GrasonBianco: "d.q.": 59.1%, "deck": 31.8%, "deku/deck-q": 9.1% (22 votes)
@QuantumBJump: "d.q.": 25%, "deck": 75% (4 votes)

I dislike seeing people incorrecting each other on how to pronounce this -- it smells a bit like gatekeeping to me. (The single correct pronunciation is obviously "da qway".)

What if we renamed Deque to something less ridiculous, like, I don't know, Queue?


The macOS speech synthesizer pronounces it as "d.q.", too.

Another name for it could be RingBuffer, reflecting the underlying data structure. I don't think I like this option, though -- we may well decide to change the implementation in the future, and it feels much too technical to me.

1 Like

“Deque” is a well-known term of art. If it's good enough for Knuth, it's good enough for me.


Knuth (and most data structures authors) need to distinguish it from the single-ended queue. We don't have this constraint -- I don't see us ever implementing a separate Queue type.


It's fine. It's a term of art, if we can't agree on how to pronounce gif, I don't think we need to agree on deque, either. There are other perfectly good names, too, but "people disagree on the pronunciation" is not a good reason to change it.


The community of artists here may be relatively narrow though. I personally have only ever seen the term used in C++, where people avoid using it anyway because the standard overspecifies it into requiring an inefficient-for-most-use-cases representation.


Why not just DoubleEndedQueue?




"Deque" isn't just a C++ism -- @kylemacomber reminded me that e.g. Python also provides a collections.deque. (Interestingly, the docs imply it isn't a random-access collection.)

People with some level of formal education in compsci tend to be familiar with the deque name, because a large number of popular algorithms/data structure books have been using it for many, many decades:

  • Knuth, Sedgewick/Wayne and Cormen/Leiserson/Rivest/Stein call it "deque",
  • Aho/Hopcroft/Ullman calls it "dequeue".
  • Interestingly, Skiena doesn't seem to mention it (or I just couldn't find it)

I expect many schools still use one of these books. (I'm sure students/profs reading this would be able to confirm/deny?)

So the term-of-art argument does very much apply here, and this is why the package currently calls it Deque.

But popularity doesn't necessarily mean that the name is any good. :wink:


If we are going to rename it, I like something explicit like this very much. I might use DoubleEndedBuffer, though; the "queue" aspect is in some ways the least interesting thing about the type.


Radical thought: We could also borrow some ideas from American English, and spell it Deck.

(This isn't entirely absurd: Knuth rationalizes the irrational pronunciation by "[deque] has some properties in common with a deck of cards".)

That's an interesting idea. DoubleEndedQueue and DoubleEndedBuffer could both work.

I worry a little that code completion would be a pain, what with Double sharing the same prefix.


There are definitely ways in which a term-of-art can be not good: for example, it could be actively misleading for users not skilled in that art but possibly skilled in a related art (cf. how we renamed floating-point “epsilon” constants), it could be outdated (and thus, arguably not a term-of-art any longer), it could be too jargony (for example, a term trying to make a distinction or clarify a point that no generalist user who’s not deeply into the nuances of the art would ever actually be confused about), and likely more.

But the “GIF” problem isn’t one of these: for one, no one’s abandoned the use of “GIF” in favor of always writing “Graphical Interchange Format.” It’s just strictly worse because it is wordy, obstructs generalist user recognition, and clarifies no salient confusion while being no less (arguably more) jargony. In the same way, while I agree that DoubleEndedQueue or a similar term would be the best possible alternative name, it would be strictly worse than Deque. And it is arguably sillier to absorb the disadvantages of such a renaming to avoid a silly name, than to stick with a silly name that everyone already uses (and, therefore, has become unsilly).


These are very good points.

As I see it, there is a slight difference between Deque and GIF:

As far as I can tell, whether one belongs to the "GHIF" or "JIF" camp doesn't indicate much of anything about one's personal background.

People who say "Deck" tend to be the ones who learned it by hearing someone say the word, rather than reading it. To me, this means they probably studied it in a formal Data Structures class, in an English-language college. Sometimes people can be real deques about this -- dismissing or undermining others just because they are self-taught and happen to call the construct "DQ".

(Citation: I first learned about this data structure in a book that called it "kétvégű sor", and I don't think I heard anyone say its English name until well into my professional carrier.)

(Edit: That got a bit darker than I intended. I think the fact that the Deque docs clearly specify the preferred pronunciation used by people in the know is an adequate workaround.)


Deque is a well known term of art and also present in the Java standard library where it is a fantastic datatype. I don't think we should rename it.

It helps a lot to be able to connect the dots with other implementations of the same concept - if I first see this type I can google for it and learn about tons of other uses of it etc.


:thinking: ... Dèque ... :laughing:


Deque is the terms of art I have heard used the most


I expect many schools still use one of these books. (I'm sure students/profs reading this would be able to confirm/deny?)

I don't know if this is helpful at all, but in my Data Structures and Introduction to Algorithm Analysis class at UTDallas (I am an undergrad student), we use the 3rd Edition of "Data Structures and Algorithm Analysis in Java" by Mark Allen Weiss. As far as I know, that book explains "dequeue" as deleting (and returning) the element at the start/front of the list. The word "deque" is used once only in a chapter exercise, and doesn't go into much elaboration of what a "deque" is.


Don't mind me but I'm kind of digging this idea :grinning_face_with_smiling_eyes:


Just provide all of these as Typealiases. :ducks:


"Ring" has a nice ring... :)

Wikipedia is another touchpoint with enough traffic/discussion to be a reasonable metric. It redirects "deque" to Double-ended_queue and (recently) agrees with the "deck" pronunciation.

Terms of Service

Privacy Policy

Cookie Policy