Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51829 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58868 invoked from network); 7 Apr 2011 22:12:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Apr 2011 22:12:06 -0000 Authentication-Results: pb1.pair.com header.from=chrisstocktonaz@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=chrisstocktonaz@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: chrisstocktonaz@gmail.com X-Host-Fingerprint: 209.85.210.42 mail-pz0-f42.google.com Received: from [209.85.210.42] ([209.85.210.42:37349] helo=mail-pz0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 25/23-36433-5B63E9D4 for ; Thu, 07 Apr 2011 18:12:05 -0400 Received: by pzk4 with SMTP id 4so1183483pzk.29 for ; Thu, 07 Apr 2011 15:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=NCptcy5jtxm3V/xW3MvHDJGiie6t6NP860zcImOswa8=; b=ES3YdO1wY7PKG3TejoN2MAjOwutMC9ZyC7ywMs2RxTcXTeuHTwxi8V1HaGj0n1dbW6 DBOdUhKRgD5cr3MB7OLe6lzWvk8oGsqGlMGKKF2AFRArnF7eVNyyDf4Xlkjm4cLfV7XT AaipsbVqKLW80afa1AYEFZ9FSLUlTHJITZVo8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Y9H8HdJzJUoNWTD9H4gdwnORnlV2hsNS2kpJukgwW3Ft3IX8uQFicBgO8SU0m942Vb 7sQZ00LLF7jvjmFOdkraC4KTgq8pSPLb0fwQiPJlXcPMWxr3Cna8oKa41BFGOpxWtmUi mUxixBvSDsDUnvrngckN6Jg5FtanEOuQ4X8h8= MIME-Version: 1.0 Received: by 10.142.209.12 with SMTP id h12mr1101571wfg.91.1302214322664; Thu, 07 Apr 2011 15:12:02 -0700 (PDT) Received: by 10.68.66.10 with HTTP; Thu, 7 Apr 2011 15:12:02 -0700 (PDT) In-Reply-To: <4D9E34C4.5000406@lerdorf.com> References: <4D950434.3060704@yahoo.com.au> <4D9E0543.1080600@lerdorf.com> <69.82.36433.EC33E9D4@pb1.pair.com> <4D9E34C4.5000406@lerdorf.com> Date: Thu, 7 Apr 2011 15:12:02 -0700 Message-ID: To: Rasmus Lerdorf Cc: "Matthew Weier O'Phinney" , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator From: chrisstocktonaz@gmail.com (Chris Stockton) Hello, On Thu, Apr 7, 2011 at 3:03 PM, Rasmus Lerdorf wrote: > On 4/7/11 5:59 PM, Matthew Weier O'Phinney wrote: >> >> It may change the semantics as they stand, but I'd argue that the >> _expectation_ from the shorthand ternary is to shorten code that >> currently uses isset(). As it is, I have almost no use for it at this >> point, as I end up needing to do: >> I don't think that changing it to do a implicit isset really fixes the reason developers use it as previously mentioned. My code is littered with isset checks, I would rather see a syntax or operator specifically for this purpose, like ?? since ?: has already been implemented in a different (and in my opinion in all to many cases not a useful) way. Syntax doesn't matter to me though long as it serves my purpose. $var = Array('foo' => 'I am set'); $value = $var['foo'] ?? 'Foo was not set'; // value = "I am set" $value = $var['bar'] ?? 'Bar was not set'; // value ="Bar was not set"; !!no warning!!