Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51901 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49294 invoked from network); 14 Apr 2011 14:05:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Apr 2011 14:05:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=landeholm@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=landeholm@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: landeholm@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-iw0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:48163] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/51-40161-C3FF6AD4 for ; Thu, 14 Apr 2011 10:05:48 -0400 Received: by iwn3 with SMTP id 3so1849753iwn.29 for ; Thu, 14 Apr 2011 07:05:46 -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:content-type; bh=AliRjdWs7N1CH6/DV4CTS4+Fe6aaFBAzSeGF5JNAL8k=; b=spcVbbecW3P7G8pAhUHSy6eYMZeAfWbxm1qvkkTxujNjk3nXd0K5qI5WEr1YRKApZq DW2sjSNkHECw5zQk/G8t0Chb//o4OFxbp3c6blBH4op6h1titloyPVhCKnRs+w1QdFfD E4lkr6o/3THwsTyXo5+L15l6KZCVfJvffrIbQ= 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 :content-type; b=TLLEw0YF5Uu4lbQX+J0v0QlS7u65NPQpScMT+80HwgTUkwKv2PDNjNGATxhxFMvTCc Ui/XK5z4dfX4c/iiCXe/OoLsKfehflEOHm7eIRq5ugzb1yZ/qk2bCKEu6Qh9pvJy+t0D KC/uqzxcWzeyg5iSShSr33H/Cfv3YNHfFNRtA= MIME-Version: 1.0 Received: by 10.231.140.34 with SMTP id g34mr624956ibu.195.1302789945916; Thu, 14 Apr 2011 07:05:45 -0700 (PDT) Received: by 10.231.33.139 with HTTP; Thu, 14 Apr 2011 07:05:45 -0700 (PDT) In-Reply-To: <4DA6FB03.9040404@yahoo.com.au> References: <4D9E0543.1080600@lerdorf.com> <69.82.36433.EC33E9D4@pb1.pair.com> <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> Date: Thu, 14 Apr 2011 16:05:45 +0200 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016e646129ef17ced04a0e16b4c Subject: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator From: landeholm@gmail.com (Hannes Landeholm) --0016e646129ef17ced04a0e16b4c Content-Type: text/plain; charset=ISO-8859-1 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". 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. 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. 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". 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. ~Hannes --0016e646129ef17ced04a0e16b4c--