Rename PriorityDequeue to DoubleEndedPriorityQueue

The word “dequeue” is already widely used as a verb meaning “remove from a queue”. At first glance when reading the docs, I assumed that was what was meant here and got confused (especially since it’s only referenced as “dequeue” and not mentioned as "double-ended queue”), and it took me a few good minutes to realize that it’s an abbreviation.

C++’s deque has a similar issue, but at least it’s visually distinct from dequeue. In Zig’s case, the type is referred to as Dequeue, which makes it harder to parse at first sight.

I personally think we should avoid the abbreviation altogether and just call it what it is: DoubleEndedPriorityQueue.

3 Likes

Some more data points how doubly ended queues named:

I only just realized: The word Deque is just a contraction of Double-ended queue, isn’t it?

yes, I don’t really understand why it is needed, but I do find it better than Dequeue since that already a word and a lot more confusing
and if we do go with Dequeue according to the zig reference it should be actually be spelled DeQueue

"Acronyms, initialisms, proper nouns, or any other word that has capitalization rules in written English are subject to naming conventions just like any other word. Even acronyms that are only 2 letters long are subject to these conventions.”

1 Like

Actually, Java also calls it Deque.
From my research, Zig is the only language I found that calls this data structure Dequeue
on Wikipedia it states

In computer science, the word dequeue can be used as:

  • A verb meaning “to remove from a queue”
  • An abbreviation for double-ended queue (more commonly, deque)

Dequeue in considered nonstandard

Probably someone added extra ue as a typo)

1 Like

According to the official style guide the current name should have been DeQueue, I think that makes it sufficiently clear that it’s not one word.

2 Likes

The thing is properly called a deque, and dequeue is already used for removing an item from a queue, so maybe correcting the spelling is enough?

1 Like

I think deque is good, it’s a really common term that several languages use (for those who aren’t aware of them previously, they’re often pronounced like “deck” and is indeed as previously mentioned is short for “double ended queue”)

1 Like

Also relevant:

3 Likes