Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51903 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56496 invoked from network); 14 Apr 2011 14:59:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Apr 2011 14:59:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=simpleshot@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=simpleshot@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: simpleshot@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:50118] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 18/62-40161-7BB07AD4 for ; Thu, 14 Apr 2011 10:59:04 -0400 Received: by eyf5 with SMTP id 5so481773eyf.29 for ; Thu, 14 Apr 2011 07:59:00 -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=hAGqmgzHlef+aj2tZnNjMffLgl+QwdSQKQZ+8mmAlbM=; b=HsXWqF1PlP2N47CZE/WQU3c7PT4ac+iASTu21vLhs10R005nqRxsaPcAgwUTNBEGns Y8WZCIOLLqaDn7hb8fIUEMYiedD3t8qAGpRmdSGXK3a5fKqJ5AsEtKMDpq0veXPU/wGe QTmAHqZ0r4PAM8lKo4nkKY4Gw2PFjS8sqCo0k= 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=xXczE0bTj0Q0GxzZfUp21i/28ZwOtUqldyXjIrYILznMZiRXTNcGt2UjMj/4s3HWc9 lFaSYmbgxRX38XHwVtRKpJ0DL65n4zJFe9RGyAYQEQMmu4RkYrWly+wZHEJD62Ec39Rw rRTId+qPFRKXGLq1alvgGR1CrXZ+GM3trV9s8= MIME-Version: 1.0 Received: by 10.213.103.203 with SMTP id l11mr2509898ebo.55.1302793140101; Thu, 14 Apr 2011 07:59:00 -0700 (PDT) Received: by 10.213.10.13 with HTTP; Thu, 14 Apr 2011 07:58:57 -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, 14 Apr 2011 10:58:57 -0400 Message-ID: To: PHP Development Content-Type: multipart/alternative; boundary=001636d3464054e16e04a0e22a18 Subject: Re: [PHP-DEV] Implicit isset/isempty check on short-ternary operator From: simpleshot@gmail.com (Adam Richardson) --001636d3464054e16e04a0e22a18 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Apr 14, 2011 at 10: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". 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 > There was also my suggestion of a "checked ternary" operator [see my previous email in this thread.] Backwards compatible, practical, and simple. Adam -- Nephtali: A simple, flexible, fast, and security-focused PHP framework http://nephtaliproject.com --001636d3464054e16e04a0e22a18--