From: chris@... Date: 2020-12-09T11:04:09+00:00 Subject: [ruby-core:101339] [Ruby master Feature#17327] The Queue constructor should take an initial set of items Issue #17327 has been updated by chrisseaton (Chris Seaton). I updated to take a single array rather than a variable number of arguments. I had two choices for how to do this - `Set` takes an `Enumerable`, using `each` to access items, and `Array` takes another `Array`, using `#to_ary` if needed. I went with the same as what `Array` does, because both `Array` and `Queue` are core libraries, where `Set` is a standard library. ---------------------------------------- Feature #17327: The Queue constructor should take an initial set of items https://bugs.ruby-lang.org/issues/17327#change-89039 * Author: chrisseaton (Chris Seaton) * Status: Open * Priority: Normal ---------------------------------------- I often create a `Queue` and then process it with a set of concurrent workers in threads. I end up writing: ```ruby q = Queue.new worklist.each do |work| q.push work end ``` I'd rather be able to write ```ruby q = Queue.new(*worklist) ``` -- https://bugs.ruby-lang.org/ Unsubscribe: