Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51902 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51809 invoked from network); 14 Apr 2011 14:26:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Apr 2011 14:26:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=mail_ben_schmidt@yahoo.com.au; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mail_ben_schmidt@yahoo.com.au; sender-id=unknown; domainkeys=good Received-SPF: error (pb1.pair.com: domain yahoo.com.au from 98.139.91.204 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: mail_ben_schmidt@yahoo.com.au X-Host-Fingerprint: 98.139.91.204 nm5-vm0.bullet.mail.sp2.yahoo.com Received: from [98.139.91.204] ([98.139.91.204:23808] helo=nm5-vm0.bullet.mail.sp2.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/C1-40161-9F307AD4 for ; Thu, 14 Apr 2011 10:26:02 -0400 Received: from [98.139.91.62] by nm5.bullet.mail.sp2.yahoo.com with NNFMP; 14 Apr 2011 14:25:59 -0000 Received: from [98.139.91.60] by tm2.bullet.mail.sp2.yahoo.com with NNFMP; 14 Apr 2011 14:25:59 -0000 Received: from [127.0.0.1] by omp1060.mail.sp2.yahoo.com with NNFMP; 14 Apr 2011 14:25:59 -0000 X-Yahoo-Newman-Id: 167648.20177.bm@omp1060.mail.sp2.yahoo.com Received: (qmail 39304 invoked from network); 14 Apr 2011 14:25:58 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.au; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=aLTWlt72QlcXMvenR/mWudt8A3iehMhWkzff9IaB2+Fif02qpGkEa+V1wT5rTMRDCF4pjfbr73a2TBiJY+y/nXh9go4aC8ysqcYmUKNw5JEYva+HdnKbFOoaUxahINznJvEyMRsV0lSnmN/G6Gn5N4gZDYDJg4xyNUEOaVKHVhc= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.au; s=s1024; t=1302791158; bh=Iz1x7jd1XciX2/Ziqyy1Z25igWpyTmnZW9ym5VyhAOU=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=kQM6djkmaD1qm37F5mMiVRtzHvOqMhHDZN+gc0f3Gw98nQblSAmLguMtbuPk3Vvj6yhX4rgqs4B/0PxbcHti0rO4abUmqSAy+AW1sgditfWquwG/3/zaDypVGhgPkcQGaj4a/u/NK4R7eyj0yOMMcpdzbbkEHms6QfKcNuWsBKI= Received: from thought.local (mail_ben_schmidt@124.168.69.175 with plain) by smtp139.mail.mud.yahoo.com with SMTP; 14 Apr 2011 07:25:57 -0700 PDT X-Yahoo-SMTP: enFMnPSswBAexaHyzgobwuUTrYOhZdJ0KRA2SjA- X-YMail-OSG: dztYdagVM1nPXKbnkreRsjrE9kXoZq.Dit6YSBPucC36SVp EkuYDjZcgION1M61saXWGGYGrMS_2yL2mjy5Lx460OPNOwynkCTGYfRAJA_h 8seobltzSVTLval20ouqDgYO6Ix4mxXgMPshrwwWS6TBAj5cnbJqPu3EFkFX gYUPzZSJaHTv.1tgimiMkhrgzHwjZoqDNonvr9Ypj3KZR.NSNEUqIlBmWwfq L4SSsQ8hrWo6b3Z71J9kQEqdQMFrnabQLssD0B.Jk5o_Lko3SXIoGJS6YExF CNuzJ3KjeittSEJDjKC70Y.BXut_SaC.V6LrdCpz.DuXTyYgYNFAuvAUVAe4 nJsSxxpaFB17hbbW2EP5ufw1BCg-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4DA703FB.3010603@yahoo.com.au> Date: Fri, 15 Apr 2011 00:26:03 +1000 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 ThunderBrowse/3.3.5 MIME-Version: 1.0 To: Hannes Landeholm CC: internals@lists.php.net References: <4D9E34C4.5000406@lerdorf.com> <4D9E429B.20503@sugarcrm.com> <4D9E96B6.6060401@lerdorf.com> <718216446.20110408143441@cypressintegrated.com> <4DA0E71C.9030008@gmail.com> <4DA63ED8.4080402@yahoo.com.au> <4DA6F2BC.10706@yahoo.com.au> <4DA6FB03.9040404@yahoo.com.au> In-Reply-To: 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: mail_ben_schmidt@yahoo.com.au (Ben Schmidt) On 15/04/11 12:05 AM, Hannes Landeholm wrote: > Trying to summarize this discussion... I think we can all agree that the > main problem is "code duplication for array access when parameters are > possibly not existing". For me the problem is 'code duplication when a value might be null' (whether an array, variable or something else, and regardless of whether it was set to null, or not defined at all). > I think we all can also agree that @ can be both used properly and > misused - and it is a blunt tool and not a nice solution to the > previously stated problem. Yes. > Some suggested that the ternary if comparison should suppress the notice > automatically. This would break existing code and also be confusing since > people expect a ternary if and normal if to work the same way. Yes. > Some suggested ?? as an array access operator that suppresses the notice and > has 3 variants: A: nothing specified - uses null as default, B: has default > specified, C: returns X if index exists or Y if index doesn't exist. This > effectively solves the code duplication problem and is a shortcut for saying > "the array index may or may not exist". This only works if the test is made an isset() kind of test. If it remains a boolean cast, it doesn't help much. (Or at least it doesn't help me much.) I also think it's a bit too blunt. In all but the simplest expressions in the condition, desired notices could be silenced. I like the idea of being able to specify exactly which array lookups should be silenced. It also doesn't help the people who want an isset() style test, but without the notice suppression, and I think there are a few people in that category. > One person said that the relation between ? and ?? and == and === would make > the operator non-intuitive. Other people disagreed and claimed the opposite. > > So basically the discussion now is what exact characters that should be used > to represent this operator? I really hope we can get this implemented > quickly... I worked with $_POST yesterday and I could really use that ?? > operator. I still don't think we've reached agreement on exactly what we need. Your summary seems to me to be of some of the earliest and least developed ideas. I think the discussion has moved in a number of interesting directions since then and we should draw on that later work. Ben.