From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id B8BF21F66F for ; Mon, 16 Nov 2020 12:22:21 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 0C0471209AB; Mon, 16 Nov 2020 21:21:37 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 0CF9E120971 for ; Mon, 16 Nov 2020 21:21:33 +0900 (JST) Received: by filterdrecv-p3mdw1-859677f5fd-r8k6r with SMTP id filterdrecv-p3mdw1-859677f5fd-r8k6r-19-5FB26C9C-54 2020-11-16 12:12:12.512976153 +0000 UTC m=+461640.423875804 Received: from herokuapp.com (unknown) by ismtpd0006p1iad2.sendgrid.net (SG) with ESMTP id 8Fw2CzQKSdKars7vIUbSwg for ; Mon, 16 Nov 2020 12:12:12.457 +0000 (UTC) Date: Mon, 16 Nov 2020 12:12:12 +0000 (UTC) From: ufuk@paralaus.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 76744 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 17327 X-Redmine-Issue-Author: chrisseaton X-Redmine-Sender: ufuk X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?nDpoD8giuogpSpkIVg1abGD85CZPbq3MTHXJTw28VcZYb1FpdWm1mQiNQUUCXf?= =?us-ascii?Q?Hug7+upui+07qOwGObIYWHwSJNTKZqa+5x7HNJA?= =?us-ascii?Q?mP79huFO6yCXZSzhbZFvw+m+U7Y3f=2FhNU40Isrm?= =?us-ascii?Q?n+U3yoEduD5LO7KJUMb1ZBZM8Idb7w4pK1LMn0I?= =?us-ascii?Q?OR7a1OM5Y1=2FqsBvZFsBRNJxUgs3RmpgWVwFYkjS?= =?us-ascii?Q?PyBnLrxtGkpfE1S04=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 100871 Subject: [ruby-core:100871] [Ruby master Feature#17327] The Queue constructor should take an initial set of items X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #17327 has been updated by ufuk (Ufuk Kayserilioglu). Agreed with @byroot (actually I was going to note the same, he beat me to it). I would also like to note that different from `Set`, for example, the order of items in the supplied parameter matters in the `Queue` case. Even though the expected outcome is for the items to be `push`ed to the `Queue` in given order, it might still be a good idea to explicitly call that out in the method documentation. ---------------------------------------- Feature #17327: The Queue constructor should take an initial set of items https://bugs.ruby-lang.org/issues/17327#change-88518 * 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/