Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77107 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78215 invoked from network); 9 Sep 2014 00:16:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Sep 2014 00:16:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.213.177 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.213.177 mail-ig0-f177.google.com Received: from [209.85.213.177] ([209.85.213.177:36514] helo=mail-ig0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/A1-63248-9D64E045 for ; Mon, 08 Sep 2014 20:16:25 -0400 Received: by mail-ig0-f177.google.com with SMTP id uq10so329568igb.4 for ; Mon, 08 Sep 2014 17:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=eUWHVwMGCEt5pbfpL+h7Dv4GJi2uLwhgXvhKKOT5+JA=; b=Zk62MWqxl3AHRDkFNLHAVGwjQsf31KDiJV1s3GY+BsAJk5HdE18bH7NUNqlYRV0ztx zGScoiyelqSu34EO871awJ/tgg2OssFIBRgpd7GA72WCz+t3J9jEGVYxoNtf3yo71eAp IkVWuIiacyoPQtZOvnOXSyEcOAfHuOWFrWPMQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=eUWHVwMGCEt5pbfpL+h7Dv4GJi2uLwhgXvhKKOT5+JA=; b=aDYun7RIC49QUcBQ8iT0QgN6q30Law5de14OazbbctI7IgqmvClBNnKVV5CgaWc32o sygGMDH8f5WFHShpcRFW7xbNQ4LKrRLcHLaW9l7wdQhZCku/xQqhKZg+9Iy9nFHPJGCJ HViblRHS1pmKvL1Y4dTWooPnaiAO+ak9WhoyzqIK8BQCN2lDltH4NFAqIF11oA+POy8/ dxuCCak+aRb3WR5k9t7B1dz1tT07YDka0e6EMcrRkNBtkvz1IjS96WLr9KxVfoqGN3x4 fPJOgYNLmQDztKOicGziDU4GGx+ZUkzyMjU4czrvdL6k8nfhyCXBj2kIHFv45rMojDPE nAHQ== X-Gm-Message-State: ALoCoQntDl4eefYxsiRLbzRBObMyfskq8c7Wwjowqw62FJcDxUF6kE+LIyhSI3bUHJZ0RVjL61RW X-Received: by 10.50.41.104 with SMTP id e8mr27287256igl.35.1410221782561; Mon, 08 Sep 2014 17:16:22 -0700 (PDT) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.43.70.143 with HTTP; Mon, 8 Sep 2014 17:16:02 -0700 (PDT) In-Reply-To: <06E02C9A-5D22-4AED-865E-1E020722DCED@ajf.me> References: <540D638B.8010303@php.net> <24B60FB5-35B8-4B6F-AD6C-54A8B24D4462@ajf.me> <540DC38B.3070700@gmx.de> <06E02C9A-5D22-4AED-865E-1E020722DCED@ajf.me> Date: Mon, 8 Sep 2014 17:16:02 -0700 X-Google-Sender-Auth: dMtGL9Z_9O2X0fl32UylFoSnk1Y Message-ID: To: Andrea Faulds Cc: 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: aharvey@php.net (Adam Harvey) On 8 September 2014 17:07, Andrea Faulds wrote: > > On 8 Sep 2014, at 23:58, Adam Harvey wrote: > >> +1 on ?? =E2=80=94 there's precedent for it, and it means we don't have = to >> explain why the shorthand form of an operator behaves differently to >> the long form, which is just going to confuse users. > > FWIW, it already behaves differently: > > oa-res-27-90:~ ajf$ php -r 'function foo() { echo "foo\n"; return tru= e; } $x =3D foo() ?: false;' > foo > oa-res-27-90:~ ajf$ php -r 'function foo() { echo "foo\n"; return tru= e; } $x =3D foo() ? foo() : false;' > foo > foo You could argue whether that's unexpected behaviour or not =E2=80=94 there = is only one foo() call in the shorthand version, after all, so it makes intuitive sense that foo() would only be called once. Regardless of how you feel about that, though, I don't think increasing the amount of inconsistency between two versions of the same operator (forget the implementation; that's how it's documented and how it's perceived) is a good idea. Adam