From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,SPF_PASS,T_DKIM_INVALID shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 52407208CD for ; Thu, 31 Aug 2017 14:28:03 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A0A7D12092A; Thu, 31 Aug 2017 23:28:00 +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 90244120920 for ; Thu, 31 Aug 2017 23:27:58 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=+fW4nBUjaCPTrRSsRIce1GSZTdY=; b=xpCVxvBuUlTQ3J+5xa rx8CIG1VZZLXdW7KYHgNZcjpyQe9vDkM/kAh57V1+dz7Qo3iHD+LCmlISVCAgUxB 71Usm4crgARI1bDRRVGcKlx9nLu93MoVs07ap60wgaQHVQgiPDuNioq1aApI+fHa OdY8bo/cBYaanaDivqKaH+O0Y= Received: by filter0005p3mdw1.sendgrid.net with SMTP id filter0005p3mdw1-16436-59A81CEA-1E 2017-08-31 14:27:54.615177146 +0000 UTC Received: from herokuapp.com (ec2-54-221-81-61.compute-1.amazonaws.com [54.221.81.61]) by ismtpd0038p1mdw1.sendgrid.net (SG) with ESMTP id CCySCy6ZSweq954XPPb4jA Thu, 31 Aug 2017 14:27:54.506 +0000 (UTC) Date: Thu, 31 Aug 2017 14:27:55 +0000 (UTC) From: nobu@ruby-lang.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 57642 X-Redmine-Project: common-ruby X-Redmine-Issue-Id: 13581 X-Redmine-Issue-Author: americodls X-Redmine-Sender: nobu 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS6kUSIlRrWAN50oFSIlComfnPU61drcZv4V4d dyUagMYYgHGReQYIIG1xxuI+11dlBy/FDKqHT177QT3QMVq0skIka0PURGK8QOrorJqoMzjMNFdiwz n5E6DsMluEpk744sfyX04jbl1i+hGeJRZiP60OLvgAYB2ARzUb5dtkuJqg== X-ML-Name: ruby-core X-Mail-Count: 82588 Subject: [ruby-core:82588] [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 nobu (Nobuyoshi Nakada). Hanmac (Hans Mackowiak) wrote: > i am not sure about that: > > ~~~ ruby > obj\ > .method > ~~~ > is already valid ruby code, so i am not sure It's different at all. My example is a token `\.`, do not split. > PS: when using "&obj.method(:symbol)" should that be optimized if able? Probably, but it's not possible to guarantee that it will return the method object. ---------------------------------------- Feature #13581: Syntax sugar for method reference https://bugs.ruby-lang.org/issues/13581#change-66410 * 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/