Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51831 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66808 invoked from network); 7 Apr 2011 23:02:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Apr 2011 23:02:57 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 207.97.245.113 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 207.97.245.113 smtp113.iad.emailsrvr.com Linux 2.6 Received: from [207.97.245.113] ([207.97.245.113:42002] helo=smtp113.iad.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/74-36433-F924E9D4 for ; Thu, 07 Apr 2011 19:02:56 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp41.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id C0774290AC5; Thu, 7 Apr 2011 19:02:52 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp41.relay.iad1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 0F81A29049E; Thu, 7 Apr 2011 19:02:51 -0400 (EDT) Message-ID: <4D9E429B.20503@sugarcrm.com> Date: Thu, 07 Apr 2011 16:02:51 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.14) Gecko/20110221 Thunderbird/3.1.8 MIME-Version: 1.0 To: Rasmus Lerdorf CC: Matthew Weier O'Phinney , "internals@lists.php.net" References: <4D950434.3060704@yahoo.com.au> <4D9E0543.1080600@lerdorf.com> <69.82.36433.EC33E9D4@pb1.pair.com> <4D9E34C4.5000406@lerdorf.com> In-Reply-To: <4D9E34C4.5000406@lerdorf.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! >> $value = isset($a[$key]) ? $a[$key] : 'Not set'; >> >> which is exactly the situation I had before it was introduced. > > Not sure why you would have that expectation. The long ternary doesn't > do that, and there is nothing about the short ternary that changes that. It is true, however I think the amount of boilerplate code produces by this paradigm is staggering, and it's about time we fixed that. We had a chance of doing it with ?: but for one reason or another it was passed, but the need is still there. I think actually the idea of "expr ?? expr2", meaning (isset($expr)?$expr:$expr2) is not bad. Anybody sees any holes in it? And yes, I wouldn't be disappointed too much if ?: didn't generate notices either. With modern IDEs times when it helped catch typos are mostly gone, and now these warnings are just a very annoying reason to write boilerplate code. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227