From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Davis Herring Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 6354e3c: Handle indentation of nested ternary operators in JS Date: Thu, 13 Apr 2017 15:36:05 -0600 Organization: XCP-1 Message-ID: <839468b2-dea8-15f3-6829-ee3723249d86@lanl.gov> References: <20170413005145.27131.34535@vcs0.savannah.gnu.org> <20170413005146.2054022EE8@vcs0.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1492121306 11247 195.159.176.226 (13 Apr 2017 22:08:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 13 Apr 2017 22:08:26 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 Cc: Dmitry Gutov , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 14 00:08:22 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cymuc-0002rn-N3 for ged-emacs-devel@m.gmane.org; Fri, 14 Apr 2017 00:08:22 +0200 Original-Received: from localhost ([::1]:51085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cymui-0006bL-KP for ged-emacs-devel@m.gmane.org; Thu, 13 Apr 2017 18:08:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cymub-0006ab-Uv for emacs-devel@gnu.org; Thu, 13 Apr 2017 18:08:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cymuX-0000K2-Vn for emacs-devel@gnu.org; Thu, 13 Apr 2017 18:08:21 -0400 Original-Received: from proofpoint7.lanl.gov ([2620:126:4000:1801::a7]:52242) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cymuX-0000JV-NP for emacs-devel@gnu.org; Thu, 13 Apr 2017 18:08:17 -0400 Original-Received: from pps.filterd (proofpoint7.lanl.gov [127.0.0.1]) by proofpoint7.lanl.gov (8.16.0.20/8.16.0.20) with SMTP id v3DLRUjv100947; Thu, 13 Apr 2017 15:36:05 -0600 Original-Received: from mailrelay2.lanl.gov (mailrelay2.lanl.gov [128.165.4.103]) by proofpoint7.lanl.gov with ESMTP id 29px88ege0-1; Thu, 13 Apr 2017 15:36:05 -0600 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailrelay2.lanl.gov (Postfix) with ESMTP id 2F6B9F82769; Thu, 13 Apr 2017 15:36:05 -0600 (MDT) X-NIE-2-Virus-Scanner: amavisd-new at mailrelay2.lanl.gov Original-Received: from bismuth.lanl.gov (bismuth.lanl.gov [128.165.246.103]) by mailrelay2.lanl.gov (Postfix) with ESMTP id 181E8F82760; Thu, 13 Apr 2017 15:36:05 -0600 (MDT) In-Reply-To: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-13_18:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1704130179 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 2620:126:4000:1801::a7 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:213951 Archived-At: >> + isSet >> + ? (isEmpty ? 2 : 3) >> + : 4 > > Not sure about JS, but at least in C, those parentheses are not needed JavaScript and C have the same ?: parsing. Moreover, I think even PHP would get that one right without parentheses, because grouping the first ? and : and the second ? and : would be self-intersecting. (What PHP gets wrong is !isSet ? 4 : isEmpty ? 2 : 3 which it, unlike all sane languages, parses as (!isSet ? 4 : isEmpty) ? 2 : 3 aka !isSet || isEmpty ? 2 : 3 which is rarely what was intended.) Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.