Should we rename Deque?

  • For argument’s sake, we could also look at the British English cheque vs. the American check. Of course the Swift project doesn’t use British English, but the spelling isn’t entirely unusual.

  • Maybe the behaviour you describe of people correcting one another will become less common once the novelty of the collections package has worn off?

  • I don’t personally have an issue with the name, but the closest thing to a problem for me is how similar the word is visually to dequeue, which also happens to be an operation one regularly performs on a deque. I think Queue rather neatly avoids this problem.

9 Likes

I am fine with any alternative naming, but I think a good first step would be to add pronunciation notes to the quick-help at least. When you see "(pronounced 'deck')" in the help you can confidently use the term and have learned something computer sciency and feel good about yourself.

Being a mechanical engineer by degree and not a native English speaker either, I still have no clue about how to pronounce certain terms of art (I am looking your way, "trie" :face_with_raised_eyebrow:) but I get some sense of accomplishment when someone tells me the correct way.

Is it now the right time to remind everyone that it's only pronounced déque if it's from the double ended region of the heap? Otherwise it's just a fancy card stack…

6 Likes

DoubleEndedArray. “Buffer” tends to imply something lower-level, and particularly something contiguous in memory, which this data structure explicitly is not.

8 Likes

I apologize for any confusion my humour may have caused. The joke was that the hypothetical spelling dèque would clearly communicate the pronunciation for any English speaker influenced by nearby French, such as those in Britain or Canada, but it would be just as wrong as it is unwieldy. While the word appears as though it ought to have a French etymology, that is not in fact the case. There is no such thing as a dèque in any language. The real origin of the word is the acronym d. e. que., which is short for double‐ended queue.

(And déque—which has the opposite slanted accent in case your device’s font is too small—would instead indicate the pronunciation dake, which is even sillier.)

5 Likes

I was spelling it wrong purely for the pun and used meaningless pseudo-Frenchification with an accent aigu.

1 Like

I really like @sharplet's observation about "cheque" vs. "check" -- especially as it can be used to strongly argue both in favor of and against renaming Deque to Deck. :see_no_evil:

If anyone ever invents a time machine, the first thing they should do is to go back and gently talk some sense into whomever first wrote down the word "deque".

4 Likes

Today I learned how to pronounce deque, but I'm still clueless about trie :sweat_smile: Will someone give a hand?

2 Likes

It's from "retrieval", and I promise we'll never use it in a public API name if I have any say in the matter. :smile:

11 Likes

Since English is the global language, there are all different kinds of “flavours” of it anyway - beyond just American and British, there’s also Chinese English, Indian English, Jamaican English, etc. They’re more than just accents - they can have their own pronunciation and a pretty extensive list of their own words. Listening to any random English-speaker is already a kind of exercise in fuzzy parsing.

I’m not sure it’s important to insist on any particular pronunciation, and I don’t view multiple pronunciations as being a problem - as long as the meaning is clear in context. And if it isn’t, people can ask.

Given that “d-q” and “deck” both seem to be quite popular, I’d say they are both acceptable. It isn’t a reason to choose a new name.

7 Likes

Without commenting on the actual issue, claiming that an alternative you don’t like is “strictly worse” when in fact it has clear advantages (it’s reasonable to assume more people will understand DoubleEndedQueue than Deque) is an unwarranted domination strategy and a form of bullying.

4 Likes

Autocomplete could trigger on DEQ, bringing this full circle :sweat_smile:

4 Likes

Excuse me?

I provided the rationale for why it's reasonable to assume that fewer people will understand DoubleEndedQueue than Deque. Indeed, that's the underlying reason why we prefer terms of art: they are easily recognizable to users in a way that alternative names are not.

The entire point of these discussion forums is to give an opinion as to whether one or more technical choices are better or worse. It is entirely valid to evaluate an option against certain criteria and conclude that it is worse than an alternative for each element of those criteria. It's not as though I'm jumping in and declaring that something is just bad and leaving the conversation.

I thought we were having a good time in this thread. I'm so upset by this comment that I'm literally shaking: Are you really jumping into a thread that you're not participating in at all to declare that you're not even commenting on the substance of the discussion, just to call two words in a post an "unwarranted domination strategy and a form of bullying"?

12 Likes

I agree, autocompletion shouldn't be an issue and Swift tends to stay away from abbreviations. I would much prefer DoubleEndedQueue.

3 Likes

The core collections in Swift are single, simple, non-abbreviated, real English words:

Array, Set, Dictionary, String

Conversely, collections that we don’t expect people to write out themselves have more lengthy, jargony, compound names:

DropFirstSequence, LazyFilterSequence, Zip2Sequence, etc.

This latter group generally arises as the return type of methods which transform existing collections, whereas the first group is often used directly with the type-name written out by the user.

It seems evident that double-ended queues are designed to be used directly, and they are not simply the result of transforming an existing collection.

• • •

Regarding the term Deque, if I may put my own experience as an anecdote, my degree is in math but I also minored in computer science so I took all the basic CS courses including data structures and algorithms.

I remember learning about queues and double-ended queues in class, and the latter were sometimes shortened to “dequeue”. However I never encountered the spelling “deque” at all in school.

I’m not sure if I’ve seen it since then either. I like to read published articles on efficient implementations of data structures and algorithms, but still I can’t remember seeing “deque” in any context.

So I would say, for myself, that “deque” is emphatically not a term of art that I would recognize.

6 Likes

another +1 for DoubleEndedQueue or (if we want to take a hint from our existing nomenclature) BidirectionalQueue

2 Likes

personally, i don’t really care what this data structure is named as long as it’s available and has a well-designed API. i think everyone would benefit from just taking a deep breath and not getting so emotionally invested in what i think is a pretty superficial aspect of this data structure. i would advise @lorentey to just pick a name yourself and go with it…

If there is going to be a renaming, I vote for Deck. I'm all for renaming to a term that is accessible to new programmers, oldheads, and global English speakers alike. Not to mention that "q/qu" has a hilariously wide range of pronunciation across world languages.

Like @nevin and @MahanazAtiqullah, I have not encountered Deque in the wild or in books enough to know it is pronounced "Deck" and not "DQ". And I would consider the Twitter chatter to be representative of how many will stumble over which pronunciation to use. Renaming to Deck seems like an easy fix.

4 Likes

This seems like a nonsequitur.

If we agree that a significant portion of the population (including the two of us) is unfamiliar with the spelling “deque”, and we further agree that a significant portion of those who are familiar with it use a pronunciation other than “deck” (a majority, according to those twitter polls), why would we use the name Deck?

That seems like it misses both marks (neither a term of art, nor readily understood by new users).

I think Karoy’s original suggestion of Queue is the way to go.

There won’t be a single-ended queue, and when a priority queue is added that will naturally be called PriorityQueue, so there are no naming conflicts.

The simple, short, relevant word “queue” seems eminently applicable and appropriate.

• • •

Hmm, “ducks” you say?

…well I suppose, DuckLoop would work too.

10 Likes

I think it would be terribly confusing if we had a BidirectionalCollection and a BidirectionalQueue, but the word “bidirectional” meant something different for each of them.

:thinking: perhaps I've forgotten what a double-ended queue is, but IIRC it's one where you can mutate from both ends. Doesn't that make it bidirectional, because you can traverse from either direction? And doesn't that match BidirectionalCollection, which says

A collection that supports backward as well as forward traversal.

1 Like