Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70409 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60238 invoked from network); 26 Nov 2013 16:50:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2013 16:50:28 -0000 Authentication-Results: pb1.pair.com header.from=petercowburn@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=petercowburn@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.42 as permitted sender) X-PHP-List-Original-Sender: petercowburn@gmail.com X-Host-Fingerprint: 209.85.219.42 mail-oa0-f42.google.com Received: from [209.85.219.42] ([209.85.219.42:44675] helo=mail-oa0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E1/24-39355-351D4925 for ; Tue, 26 Nov 2013 11:50:28 -0500 Received: by mail-oa0-f42.google.com with SMTP id i4so6340183oah.1 for ; Tue, 26 Nov 2013 08:50:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=w6pdSX9B/mCl3uD96cMwWgf5+F4xzrfktsuf/GODYl4=; b=qBJ9bxgLLaXXhW/gmudKOGreVhTMM24/4dy4XyyIjX4+RF9/9pU8K4LpXAfRnoA363 VOU7QqT309RrKwRblQv+2QoV8AzK0wvWlt+eMytNie9wS1EHWcYiNbVCOGUJP983t0Ux AVa3bTwMVVxRiGDWjwXpXNL3ORJuJdAqOgwddGrkyvVNjhctM+88ty83jOfi3kac6lf7 imcoeCQ4/W6x1skHj9UWKcOI4oj4HV7YlCESsisumNE+czBQsA0h+DIewM0RfWca11Rt xjNfJsYE318dbqUOiGjavOKVH9iTsioKp3F21XwUJiT6m+6f5tNB0Mar5F2sKXrY8XvP 31rA== X-Received: by 10.182.229.34 with SMTP id sn2mr375534obc.86.1385484625389; Tue, 26 Nov 2013 08:50:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.76.23.98 with HTTP; Tue, 26 Nov 2013 08:49:45 -0800 (PST) In-Reply-To: References: Date: Tue, 26 Nov 2013 16:49:45 +0000 Message-ID: To: Jannik Zschiesche Cc: Mats Lindh , Chris London , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11349750f0303c04ec1746bd Subject: Re: [PHP-DEV] [Proposal] Modification to ?: functionality From: petercowburn@gmail.com (Peter Cowburn) --001a11349750f0303c04ec1746bd Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 26 November 2013 15:32, Jannik Zschiesche wrote: > Hi, > > > Am Dienstag, 26. November 2013 um 16:15 schrieb Mats Lindh: > > > On Tue, Nov 26, 2013 at 3:43 PM, Chris London me@chrislondon.co)> wrote: > > > following would be functionally equivalent: > > > > > > $foo =3D isset($foo) && $foo ? $foo : 'default'; > > > > > > $foo =3D $foo ?: 'default'; > > > > The would break the assumption that a reference to an uninitialized val= ue > > would generate a notice, unless explicitly handled in the logic. > > > > While I also would like to have something similar to ?: to handle defau= lt > > values for array keys, etc., this would change a fundamental assumption > > that as been in place for many years now. I'm not sure if that's a BC > break > > that would be acceptable this late. An alternative operator may be more > > suitable. > > Since the discussion about it is quite vivid at the moment: > wouldn=92t this be a nice candidate for one of the changes in the next ma= jor > version? > > What are your (everyone's) thoughts on the following, given the current topic of discussion? $foo =3D $fo ?: 'default'; // see what I did there? I'm not sure changing the ?: to always use isset() is necessarily a good thing given my propensity for tiping mystakes. > > -- > Cheers Jannik > > > --001a11349750f0303c04ec1746bd--