From: chris@chrisseaton.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:100861] [Ruby master Feature#17327] The Queue constructor should take an initial set of items
Date: Sun, 15 Nov 2020 22:13:19 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-88505.20201115221318.8671@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17327.20201115220645.8671@ruby-lang.org
Issue #17327 has been updated by chrisseaton (Chris Seaton).
I'm not worried about `Queue.new(worklist)` or `Queue.new(*worklist)`, so that's fine if more people feel that way. I think the key thing is conciseness in text source code, and also avoiding needing to synchronise while adding each individual item.
----------------------------------------
Feature #17327: The Queue constructor should take an initial set of items
https://bugs.ruby-lang.org/issues/17327#change-88505
* 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/
next prev parent reply other threads:[~2020-11-15 22:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-15 22:06 [ruby-core:100858] [Ruby master Feature#17327] The Queue constructor should take an initial set of items chris
2020-11-15 22:07 ` [ruby-core:100859] " chris
2020-11-15 22:11 ` [ruby-core:100860] " samuel
2020-11-15 22:13 ` chris [this message]
2020-11-15 22:50 ` [ruby-core:100862] " samuel
2020-11-16 9:11 ` [ruby-core:100870] " jean.boussier
2020-11-16 12:12 ` [ruby-core:100871] " ufuk
2020-12-09 11:04 ` [ruby-core:101339] " chris
2021-01-13 6:05 ` [ruby-core:102050] " matz
2021-01-29 8:50 ` [ruby-core:102290] " ko1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-88505.20201115221318.8671@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).