Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77135 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14095 invoked from network); 10 Sep 2014 09:31:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Sep 2014 09:31:49 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.51 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.51 mail-qa0-f51.google.com Received: from [209.85.216.51] ([209.85.216.51:37894] helo=mail-qa0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/63-24203-48A10145 for ; Wed, 10 Sep 2014 05:31:48 -0400 Received: by mail-qa0-f51.google.com with SMTP id j7so17154633qaq.10 for ; Wed, 10 Sep 2014 02:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=P1Ixyssr5b/0IDzt7C0LcUKSxb9KqKVM7tP8WVjuq7U=; b=UrIywERtjEj/ZrPQkGXHeZTdz96bJM/rrwSM+moDVdgKVfXVcIaMf+KrCkA4NdjeYa jWZ1Si6DozH1FGulFV82uTHM2qVls2I/F5cymCyjht4r8bAoCsS0IHYE5tRotyrwKtLZ UHB9XHBv/oiAtL4gvDg1BrCXRbR5BrkAGiiOeHSfQUh0+HlqoUrngFtJ2bL5ebsC/sST 4vj8BMJCGaIW9DXCUcLNg402x1yzta+ePG8oCd8/7tRvfWcH7h15vbZZ84iWu7BHSarF aWpjLehJ94FPvBQUnVqNc0JvARluyIueL7vndW6Kdx5ke2GZS0Va0O/0kyg6IabiRJH9 44YA== MIME-Version: 1.0 X-Received: by 10.229.68.131 with SMTP id v3mr58463896qci.10.1410341505077; Wed, 10 Sep 2014 02:31:45 -0700 (PDT) Received: by 10.140.22.51 with HTTP; Wed, 10 Sep 2014 02:31:44 -0700 (PDT) In-Reply-To: References: <540D638B.8010303@php.net> <24B60FB5-35B8-4B6F-AD6C-54A8B24D4462@ajf.me> <540DC38B.3070700@gmx.de> Date: Wed, 10 Sep 2014 11:31:44 +0200 Message-ID: To: Adam Harvey Cc: Christoph Becker , Andrea Faulds , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Implicit isset() in Shorthand Ternary Operator From: pierre.php@gmail.com (Pierre Joye) On Tue, Sep 9, 2014 at 12:58 AM, Adam Harvey wrote: > On 8 September 2014 07:56, Christoph Becker wrote: >> Am 08.09.2014 15:58, schrieb Andrea Faulds: >>> We could add such an operator, perhaps with the ?? syntax. However, I >>> don=E2=80=99t really like the idea. It=E2=80=99s too similar to ?: so I= don=E2=80=99t think >>> it=E2=80=99d be accepted, and even if it was, I=E2=80=99m not sure we r= eally need >>> another operator. I=E2=80=99d much rather just make ?: do what, IMO, is= the >>> right thing and what it always should have done. >> >> I'd rather had a shortcut for the following: >> >> isset($_GET['foo']) ? $_GET['foo'] : BAR > > Agreed. That's what ifsetor requests have generally boiled down to > over the years, so it seems to be what the masses want. > > It's what _I_ want, anyway. :) > >> Of course, it is not possible to change the ?: operator to work this way >> for BC reasons, but a new operator such as ?? might make sense. > > +1 on ?? =E2=80=94 there's precedent for it, and it means we don't have t= o > explain why the shorthand form of an operator behaves differently to > the long form, which is just going to confuse users. After a 2nd look I have to agree here too. Changing behavior in something so widely used as the current operator will likely create more pains. A new operator, clearly documented, sounds much cleaner, even more as it does something different anyway. --=20 Pierre @pierrejoye | http://www.libgd.org