[ruby-core:70651] [Ruby trunk - Misc #11500] [Open] [RFC] rename Queue to UnboundedQueue

From: normalperson@...
Date: 2015-09-01 22:00:57 UTC
List: ruby-core #70651
Issue #11500 has been reported by Eric Wong.

----------------------------------------
Misc #11500: [RFC] rename Queue to UnboundedQueue
https://bugs.ruby-lang.org/issues/11500

* Author: Eric Wong
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Then deprecate and warn on usage of "Queue"

Or maybe even call the new one "UnsafeQueue" :)

I think the name "Queue" causes too many people to use it without
knowing the consequences of unbounded memory growth and lack of backpressure.

In all cases I can think of, SizedQueue should be used instead of
current Queue since it will not cause a process to grow out-of-memory.

On the other hand, Ruby still has too many ways for users to shoot themselves in
the foot with unbounded memory growth:

* using IO#read with no length argument
* IO#gets on unknown data
* Net::HTTP or open-uri to slurp a big file into memory
* "SELECT" from a DB library with no LIMIT
... etc.

And having one extra guideline won't help less-experienced Rubyists at all...




-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next