Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51968 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83616 invoked from network); 20 Apr 2011 23:56:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2011 23:56:52 -0000 Authentication-Results: pb1.pair.com header.from=arraypad@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=arraypad@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: arraypad@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:57167] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/30-24878-3C27FAD4 for ; Wed, 20 Apr 2011 19:56:51 -0400 Received: by vxb40 with SMTP id 40so1021644vxb.29 for ; Wed, 20 Apr 2011 16:56:49 -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=W9tjTu/TiRjzBKBI8gjdB2uIyajFppbXbBTqlWsEr3M=; b=qkolEy7sg4ziXzTIPvwtT9SjOHO3gpk51+8ZOK1FCly8+xF1EtXMF4eftyg0z+TY2V ArHvOW7QP+hRPSzIgtfOLQnC0gp3ZPqWvovkGMl7R9nOhokjK/AFOcn+yShCOAM6AaVa uPPpfQ1B9HtBdDqOBnnHSe3AYE0x6AkIiUfCg= 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=xXQw7G1XvppQL/neHJImEfgGkYDVhk25kLr/dVJAww5ycV6SFzePMKrjWEW/3Fp1uo PR6SJI0jVstOM/tD54ojwpp6wAJmSNetwclP9kqEgxZqrEUl+D8Se87chBBizlXncXsA qULLTLO6NNqHHhjXzQTWJNmDAB15UpOOsa+yo= MIME-Version: 1.0 Received: by 10.52.71.97 with SMTP id t1mr4645062vdu.246.1303343809014; Wed, 20 Apr 2011 16:56:49 -0700 (PDT) Received: by 10.52.107.98 with HTTP; Wed, 20 Apr 2011 16:56:48 -0700 (PDT) In-Reply-To: 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, 21 Apr 2011 00:56:48 +0100 Message-ID: To: Hannes Landeholm Cc: 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: arraypad@gmail.com (Arpad Ray) On Thu, Apr 14, 2011 at 3:05 PM, Hannes Landeholm wrote: > 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. Hi, I must say that the prospect of yet more new syntax is scary. It really looks like Perl, and I wouldn't have the slightest clue what it meant if I'd missed the release notes. I've pined for something like coalesce($_GET['foo'], $defaults['foo'], 42) for years, and I think that style is far more in keeping with the PHP ethos, and far more readily understandable than this suggested new syntax. If I've missed some argument against this then please correct me. Regards, Arpad