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=-2.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,SPF_PASS, T_DKIM_INVALID shortcircuit=no autolearn=no 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 0B577208E3 for ; Fri, 1 Sep 2017 06:36:34 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 57546120949; Fri, 1 Sep 2017 15:36:31 +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 06433120948 for ; Fri, 1 Sep 2017 15:36:28 +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=xInCs3J+QRRaA5595z95DK0o6ig=; b=vwGHrnrozU1XspXboF qSOkJqWYUmUsGM1TAwklET00lU0W0UokAKVXnb8aSzrHMiXgfSkzbs6oOH1GTZ07 NvZLL0o01H7CH1HSFVyfCYdocsXfHjp8tsSSfI1xTnqczKTm3mFyaJ+aCZTFjrmN x4803O3FE06rjldQRnca7cRm4= Received: by filter0014p3las1.sendgrid.net with SMTP id filter0014p3las1-20137-59A8FFE9-2A 2017-09-01 06:36:25.853292139 +0000 UTC Received: from herokuapp.com (ec2-54-205-243-216.compute-1.amazonaws.com [54.205.243.216]) by ismtpd0005p1iad1.sendgrid.net (SG) with ESMTP id ZO33zSE9T7ads5lN8m3BVw Fri, 01 Sep 2017 06:36:25.694 +0000 (UTC) Date: Fri, 01 Sep 2017 06:36:26 +0000 (UTC) From: tom.dalling+ruby-lang@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 57667 X-Redmine-Project: common-ruby X-Redmine-Issue-Id: 13581 X-Redmine-Issue-Author: americodls X-Redmine-Sender: tom_dalling 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS7eQXus/l9m5G4im4bwanM4mfox6ErOdzP/VM eSUtocxyGSUN41jQ4qMwQ+nuobR3hflWkmYimkRe43enzKJbvXE2G4Rs7LBuJmpMJFdxHteBqPlffu ugcSVCRMDWfZ7WQKbT3HyuDSEhcUbNXOAsV16vEmHa52mdg188NqKNmFpz7gD59MRNDhxj+TsqHK6x E= X-ML-Name: ruby-core X-Mail-Count: 82612 Subject: [ruby-core:82612] [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 tom_dalling (Tom Dalling). What about triple colon `:::`? ```ruby [1,2,3].map(&Math:::sqrt) [1,2,3].each(&:::puts) ``` `::` is for looking up constants, so it kind of makes sense that `:::` is for looking up methods. ---------------------------------------- Feature #13581: Syntax sugar for method reference https://bugs.ruby-lang.org/issues/13581#change-66436 * 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/