Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51915 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66791 invoked from network); 16 Apr 2011 10:01:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Apr 2011 10:01:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=olemarkus@olemarkus.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=olemarkus@olemarkus.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain olemarkus.org from 213.236.166.183 cause and error) X-PHP-List-Original-Sender: olemarkus@olemarkus.org X-Host-Fingerprint: 213.236.166.183 unknown Received: from [213.236.166.183] ([213.236.166.183:60027] helo=remus.fluks.no) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 85/00-00728-50969AD4 for ; Sat, 16 Apr 2011 06:01:42 -0400 Received: from localhost (localhost [127.0.0.1]) by remus.fluks.no (Postfix) with ESMTP id 9BD83503C5A; Sat, 16 Apr 2011 12:01:38 +0200 (CEST) X-Virus-Scanned: amavisd-new at fluks.no Received: from remus.fluks.no ([127.0.0.1]) by localhost (remus.fluks.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IYTp-uYc0R1F; Sat, 16 Apr 2011 12:01:37 +0200 (CEST) Received: from localhost (7.233.16.62.customer.cdi.no [62.16.233.7]) by remus.fluks.no (Postfix) with ESMTPA id CADFF503A5D; Sat, 16 Apr 2011 12:01:36 +0200 (CEST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "PHP Development" , "Adam Richardson" References: <718216446.20110408143441@cypressintegrated.com> <4DA0E71C.9030008@gmail.com> <4DA63ED8.4080402@yahoo.com.au> <4DA6F2BC.10706@yahoo.com.au> <4DA6FB03.9040404@yahoo.com.au> <4DA8E6D9.5080107@yahoo.com.au> Date: Sat, 16 Apr 2011 12:01:07 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: User-Agent: Opera Mail/11.00 (Linux) Subject: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator From: olemarkus@olemarkus.org ("Ole Markus With") On Sat, 16 Apr 2011 03:42:11 +0200, Adam Richardson wrote: > On Fri, Apr 15, 2011 at 8:46 PM, Ben Schmidt > wrote: > >> There was also my suggestion of a "checked ternary" operator [see my >>> previous email in this thread.] Backwards compatible, practical, and >>> simple. >>> >> >> It doesn't address the main issues of code duplication and nullness >> checking, IMHO, so isn't a contender. Even though it's simple and >> compatible, it is only practical in a handful of cases. >> > > I believe describing nullness checking as a "main" issue is a rather > strong > assessment. > I agree. To me, nullness checking is not interesting at all. > > $var = $arr['key'] ?? : 'empty'; > > is a significant improvement over the current means and does in fact > remove > redundant code. > If I understood it correctly, this is the essense of what I want. Compared to the original description of checked ternary I strongly object to this working on non-arrays. But given that constraint, my vote goes to the checked ternary operator as well. -- Ole Markus With