Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60171 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24310 invoked from network); 18 Apr 2012 08:44:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2012 08:44:19 -0000 Authentication-Results: pb1.pair.com header.from=hartmut.holzgraefe@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=hartmut.holzgraefe@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: hartmut.holzgraefe@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bk0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:65386] helo=mail-bk0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 95/D3-03614-2EE7E8F4 for ; Wed, 18 Apr 2012 04:44:19 -0400 Received: by bkcje9 with SMTP id je9so5882054bkc.29 for ; Wed, 18 Apr 2012 01:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=7mCK3HTXjII/28ZSMUuLClG33J2yBamY9NjWaJLH2GI=; b=fCBZSHIHZFy6PvwyO5ZFueZNex0Z9lbAUbB8W9qnOSOuvRhWo+iwhayRqluZSMGTVh nSOE8calXmAqVHHQHSOaR0lJm/rT7AseDRFdkkFhPhfyycQ3FcGCtmo9V1j/746uASAs rdfDjzYwUawjw/F4hHs2PAAS7rFDf1M+GZoHEuGEb+wg/nV62Xf20kjyBUB93lyE412r hJg9BnenjZmwtSYz26hOJ/voMYuUT99Vc3VS908AA3KmYlBKYGqwMr10U70Qe6XWhe0H ZtckX/GgJr1Lf44PGXw6FZJyplHIqt2dXalOvKwfkkziSdvjwaQD9W01XRtfdsRTHR3s LqFg== Received: by 10.205.132.145 with SMTP id hu17mr409444bkc.66.1334738655911; Wed, 18 Apr 2012 01:44:15 -0700 (PDT) Received: from [192.168.23.15] (212.100.42.202.fixip.bitel.net. [212.100.42.202]) by mx.google.com with ESMTPS id cy11sm42621249bkb.7.2012.04.18.01.44.15 (version=SSLv3 cipher=OTHER); Wed, 18 Apr 2012 01:44:15 -0700 (PDT) Sender: hartmut holzgraefe Message-ID: <4F8E7EE1.4020906@php.net> Date: Wed, 18 Apr 2012 10:44:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: internals@lists.php.net References: <-2535359201658036561@unknownmsgid> In-Reply-To: <-2535359201658036561@unknownmsgid> X-Enigmail-Version: 1.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [off] PHP: a fractal of bad design From: hartmut@php.net (Hartmut Holzgraefe) On 04/11/2012 05:19 PM, Luke Scott wrote: > The only thing that infuriates me is the ternary operator being left > associative. I want that fixed - screw bc on that one! I have been > programming for 10 years and that one still confuses me! Most people > just add parentheses to "fix" the problem. I wish someone would write > an RFC to change this to right associative like every other language! > *hint hint* i actually never noticed this until now as i keep it as a best practice to never nest ternaries anyway, in any language. To me it's at least as much a sign for a desseased mind as using multiple exclamation marks !!!11eleven ;) The problem i see though is that in code that really relies on this it may become a real nightmare to track down what goes wrong if evaluation order is changed if you're not aware of that change having happened. An E_DEPRECATED may help here, but will also produce a lot of false positives for those using parentheses? Or can we add enough parser magic to only throw warnings for the unsafe uses? ... -- hartmut