Skip to content

Describe Deque as "output-restricted." #12285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 22, 2025

Conversation

player-03
Copy link
Contributor

Despite its name, Deque is a regular one-way queue. "Double-ended" implies you can add to and remove from either end, which isn't the case. It's far too late to change the name, so I'll settle for making the documentation more accurate.

Despite its name, `Deque` is a regular one-way queue. "Double-ended" implies you can add to and remove from either end, which isn't the case.
@Simn
Copy link
Member

Simn commented Jun 21, 2025

Hmm, you can add on both ends, you just can only remove from one end. So technically it's double-ended with restricted functionality I think?

@player-03
Copy link
Contributor Author

Looking into it, it turns out there's a term for this: "output-restricted queue" or "output-restricted deque" (sources disagree). So I guess it is valid.

@player-03 player-03 changed the title Don't describe Deque as "double-ended." Describe Deque as "output-restricted." Jun 21, 2025
@Simn Simn merged commit 0c95e9b into HaxeFoundation:development Jun 22, 2025
48 checks passed
@Simn
Copy link
Member

Simn commented Jun 22, 2025

Even in context I don't feel like "output-restricted" tells me anything, but if this makes you happier then I'm glad to update the docs!

@player-03
Copy link
Contributor Author

Hang on, if this doesn't feel informative, I'd rather take another stab at it. Good documentation should be both technically correct and easy to understand. Also, now that I think about it, we could stand to describe the use case in more detail.

A Deque is a double-ended queue with functions that can safely be called on multiple threads at once. Its pop method can block until an element is available, and is commonly used to synchronize threads.

Due to the requirements of thread safety, Deque's output is restricted. Elements may only be removed from the front, and may not be viewed except by removing them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants