From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 3785719C003C for ; Mon, 9 Nov 2015 23:10:44 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 8AD58B5D8F8 for ; Mon, 9 Nov 2015 23:40:12 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 0669E18CC7EF for ; Mon, 9 Nov 2015 23:40:12 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id D416812046C; Mon, 9 Nov 2015 23:40:10 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 59B1C120439 for ; Mon, 9 Nov 2015 23:40:07 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=giM5PIa6yAEEr2727GTCWevIZa0=; b=K8OpOC6ch6ITe6CsRU +XnXDOoVwh3fwUi7S7UsU0rbL+70RRsO8NNuecd8FQ8LD9rR7V4uN9autVDjqY14 HZwVmrpvtsd/WqN6a1plE/g2FO6+3qmDk/oTzhyC3xJjYc2tEAylEEKx/pNpuBS9 1/PkHxq7js8mqJ14HxkRo9XSQ= Received: by filter-327.sjc1.sendgrid.net with SMTP id filter-327.5612.5640B0373E 2015-11-09 14:39:51.947496529 +0000 UTC Received: from herokuapp.com (ec2-54-82-26-27.compute-1.amazonaws.com [54.82.26.27]) by ismtpd0002p1iad1.sendgrid.net (SG) with ESMTP id euxOh-8qRRmFF-Nt8ocOwQ for ; Mon, 09 Nov 2015 14:39:51.947 +0000 (UTC) Date: Mon, 09 Nov 2015 14:39:51 +0000 From: tom.enebo@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 46058 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11537 X-Redmine-Issue-Author: hsbt X-Redmine-Issue-Assignee: matz X-Redmine-Sender: enebo 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS5YVvFx4KmEd/xuA+eCQ147zsfguQvyS+i5Eh r+rMALHpL0WlslA4y3Sxkd7POAtdazr8/XQ0QlKKAvXUvX+f5gtuqSQgJKfT+k/FfnxGCF/y7VHndx fGRJRfcOrwjSTDE= X-ML-Name: ruby-core X-Mail-Count: 71417 Subject: [ruby-core:71417] [Ruby trunk - Feature #11537] Introduce "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: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11537 has been updated by Thomas Enebo. Nobuyoshi Nakada wrote: > Binary operators implicitly continue the next line, without a backslash. > > e.g., > > ~~~ruby > foo + > 1 > ~~~ > > is same as `foo + 1`. > > If `\` were become a binary operator, there is an ambiguity. > > ~~~ruby > foo \ > 1 > ~~~ > > is `foo(1)` (current interpretation) or `foo\1`? I am willing to withdraw this proposal and it is potentially ambiguous (although still able to be properly parsed) but I can count the number of times I have seen a rubyist use a line continuation with zero fingers :) So I do not think they confusion would be very large. -Tom ---------------------------------------- Feature #11537: Introduce "Safe navigation operator" https://bugs.ruby-lang.org/issues/11537#change-54786 * Author: Hiroshi SHIBATA * Status: Open * Priority: Normal * Assignee: Yukihiro Matsumoto ---------------------------------------- I sometimes write following code with rails application: ```ruby u = User.find(id) if u && u.profile && u.profile.thumbnails && u.profiles.thumbnails.large ... ``` or ```ruby # Use ActiveSupport if u.try!(:profile).try!(:thumbnails).try!(:large) ... ``` I hope to write shortly above code. Groovy has above operator named "Safe navigation operator" with "`?.`" syntax. Ruby can't use "`?.`" operator. Can we use "`.?`" syntax. like this: ```ruby u = User.find(id) u.?profile.?thumbnails.?large ``` Matz. How do you think about this? -- https://bugs.ruby-lang.org/