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_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_PASS,T_DKIM_INVALID, T_RP_MATCHES_RCVD 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 5C4791FAED for ; Fri, 9 Jun 2017 09:53:13 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 85BEA1207C1; Fri, 9 Jun 2017 18:53:10 +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 8884F1207C0 for ; Fri, 9 Jun 2017 18:53:08 +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=GcuYCrBcg1sJAMyWObioCQNoNqY=; b=KEhV93QuWuAQMKY2u7 Jdp5Bljf+xQTcTaiucPT9cJIDuJvCaURbdR+w10gHUq+EXapjEwttV36NQsAyx5b mHQke+etTmjvkhguQNH3YTRLcHy3udvfRxBUOtZYh6o/G/kV11UTnFhyUE6z+sYb 3dubr63wUYF5mg9YsBDJHNhRI= Received: by filter0418p1mdw1.sendgrid.net with SMTP id filter0418p1mdw1-21430-593A6FEA-8 2017-06-09 09:52:42.160192783 +0000 UTC Received: from herokuapp.com (ec2-54-91-11-49.compute-1.amazonaws.com [54.91.11.49]) by ismtpd0003p1iad1.sendgrid.net (SG) with ESMTP id a1J40MjrRC2F4QKR77BTSQ for ; Fri, 09 Jun 2017 09:52:42.136 +0000 (UTC) Date: Fri, 09 Jun 2017 09:52:41 +0000 From: shevegen@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 56660 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 13645 X-Redmine-Issue-Author: ndn X-Redmine-Sender: shevegen 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS6218FQxOp91rcuFyCc8U5E+ODOBfKbM/pDKK KoOE8S8ivN4P1LxZnWP1YruGqTfnPemMw8kUBiQQjrc7Ci+Tzkqki06bBHxtqHBSS8miGpq4DCeWhb eqrkUX0yjgvPvZtSI2AgVLBMxFg7uftq5JZsfKFbxV/iFilnMWAzhaBvEw== X-ML-Name: ruby-core X-Mail-Count: 81634 Subject: [ruby-core:81634] [Ruby trunk Feature#13645] Syntactic sugar for indexing when using the safe navigation operator 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 #13645 has been updated by shevegen (Robert A. Heiler). Is this valid syntax? I ask specifically because of the '.' character there. I am not a big fan of the & anyway though, so I am biased. I am just wondering in context of syntax such as: hash[:key] hash&[:key] hash&.[:key] Actually I only consider the first elegant, the rest ugly. But I see your point in regards to hash&.[](:key) versus hash&.[:key] - if the former already works as-is, then it may make sense to allow for the latter. What I thought was that the '.' is explicit for the method call; I guess the last example: hash&.[:key] Would then be equivalent to: hash&.[(:key)] right? ---------------------------------------- Feature #13645: Syntactic sugar for indexing when using the safe navigation operator https://bugs.ruby-lang.org/issues/13645#change-65330 * Author: ndn (Nikola Nenkov) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- # Proposal While it works and makes sense, this is a bit cumbersome: ```ruby hash&.[](:key) ``` Ideally, we could use something like: ```ruby hash&.[:key] ``` -- https://bugs.ruby-lang.org/