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-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.8 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_PASS shortcircuit=no autolearn=no 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 77AC91F87F for ; Thu, 15 Nov 2018 10:58:44 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 26801120EEC; Thu, 15 Nov 2018 19:58:42 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 55E6E120CC0 for ; Thu, 15 Nov 2018 19:58:39 +0900 (JST) Received: by filter0163p3mdw1.sendgrid.net with SMTP id filter0163p3mdw1-547-5BED515B-17 2018-11-15 10:58:35.492797459 +0000 UTC m=+546897.384544820 Received: from herokuapp.com (ec2-54-221-76-19.compute-1.amazonaws.com [54.221.76.19]) by ismtpd0048p1mdw1.sendgrid.net (SG) with ESMTP id MwlpMLIYQOSqggT7qolFZw Thu, 15 Nov 2018 10:58:35.506 +0000 (UTC) Date: Thu, 15 Nov 2018 10:58:36 +0000 (UTC) From: zverok.offline@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 65202 X-Redmine-Project: common-ruby X-Redmine-Issue-Id: 13581 X-Redmine-Issue-Author: americodls X-Redmine-Sender: zverok 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS5Sfef5Z7MOgt4uxrlJv7uaMXufSjvakjdCOI xzdE9qO66Xo8t9H4rwS6Bih0D4illuQiQbQqsvgAD+JtDL6PiWn/fBLci/McswuWEph2VatV8/4GNv eqMvc/91PvlBB2txiKOLgIJawgur6YisUUNvtJRnEo4IldnvxJephPFJ3A== X-ML-Name: ruby-core X-Mail-Count: 89811 Subject: [ruby-core:89811] [CommonRuby Feature#13581] Syntax sugar for method reference 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 #13581 has been updated by zverok (Victor Shepelev). > I like solutions for real problems, not imaginary. The `map(&method(:local_method))` or `yield_self(&method(:local_method))` pattern is absolutely real and very useful. My point was, we have plenty in our current codebase (and no, they are not "you just need to wrap collection items", my example was exaggerated for the illustrative purposes). And I can definitely say it brings value for code design and clarity, and will be even more so with `map(&.:local_method)` syntax. ---------------------------------------- Feature #13581: Syntax sugar for method reference https://bugs.ruby-lang.org/issues/13581#change-74873 * Author: americodls (Americo Duarte) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Some another programming languages (even Java, in version 8) has a cool way to refer a method as a reference. I wrote some examples here: https://gist.github.com/americodls/20981b2864d166eee8d231904303f24b I miss this thing in ruby. I would thinking if is possible some like this: ~~~ roots = [1, 4, 9].map &Math.method(:sqrt) ~~~ Could be like this: ~~~ roots = [1, 4, 9].map Math->method ~~~ What do you guys thinking about it? -- https://bugs.ruby-lang.org/