Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77306 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64476 invoked from network); 18 Sep 2014 11:33:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2014 11:33:02 -0000 Authentication-Results: pb1.pair.com header.from=pete@the-echoplex.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pete@the-echoplex.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain the-echoplex.net from 208.113.200.129 cause and error) X-PHP-List-Original-Sender: pete@the-echoplex.net X-Host-Fingerprint: 208.113.200.129 sub5.mail.dreamhost.com Windows 98 (1) Received: from [208.113.200.129] ([208.113.200.129:45503] helo=homiemail-a48.g.dreamhost.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/20-63310-BE2CA145 for ; Thu, 18 Sep 2014 07:33:00 -0400 Received: from homiemail-a48.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a48.g.dreamhost.com (Postfix) with ESMTP id AAA4C4F805C for ; Thu, 18 Sep 2014 04:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=the-echoplex.net; h= mime-version:in-reply-to:references:date:message-id:subject:from :to:cc:content-type; s=the-echoplex.net; bh=xlY/yO90hyui4wKOWGS+ VzxDtaM=; b=OC5HsxrWth+vKgKizc+WnzfUIrPzcKmE5F+ZcKv2H2YDcenGIylW Qg0itAyXCUQGH81nzbE5jOsvBYINakLKJ6u2WYYirGNJFzyxTCNQbMnd57iyP4fe 6Hwq/npFuHiWw0n5JXg7Z7rT3kTojNA64wIITaOzVRlr9ZP1aOWvd7c= Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: pete@the-echoplex.net) by homiemail-a48.g.dreamhost.com (Postfix) with ESMTPSA id 5DCD24F805B for ; Thu, 18 Sep 2014 04:32:56 -0700 (PDT) Received: by mail-wg0-f49.google.com with SMTP id m15so738322wgh.32 for ; Thu, 18 Sep 2014 04:32:54 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.206.103 with SMTP id ln7mr4310887wjc.30.1411039974985; Thu, 18 Sep 2014 04:32:54 -0700 (PDT) Received: by 10.194.15.72 with HTTP; Thu, 18 Sep 2014 04:32:54 -0700 (PDT) In-Reply-To: <54E82419-931D-4F9E-8115-175EA1BDC970@darkrainfall.org> References: <54E82419-931D-4F9E-8115-175EA1BDC970@darkrainfall.org> Date: Thu, 18 Sep 2014 12:32:54 +0100 Message-ID: To: Gwynne Raskind Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7bb708e07919ea050355584b Subject: Re: [PHP-DEV] [RFC] Implicit isset() in Shorthand Ternary Operator From: pete@the-echoplex.net (Pete Boere) --047d7bb708e07919ea050355584b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I'm seeing '??' as analogous to the way JS developers use '||', and I use that all the time when writing JS. Personally I wouldn't be interested in a function version because the short-circuiting of '??' is an important distinction; not something you can replicate with a function. Therefore having both would be confusing IMO. Also, not much sure about a '??=3D', perhaps it should be a followup RFC should '??' be accepted. On 18 September 2014 10:26, Gwynne Raskind wrote: > On Sep 17, 2014, at 11:40, Matthew Fonda wrote: > > Hi Andrea, > > > > This is great -- thanks to you and Nikita for the work here. > > > > Syntax wise, I would prefer a function-like syntax, e.g. coalesce($a, $= b, > > 'c') or ifsetor() instead of $a ?? $b ?? 'c'. I find this more readable= , > > and it avoids any possible confusion about precedence within the > > expressions. Either way, still +1 for this feature. > > > > Best regards, > > --Matthew > > I=E2=80=99m STRONGLY +1 in favor of this operator, ASAP; I=E2=80=99ve had= to write more > than a few hacks to keep a large codebase I=E2=80=99m responsible from be= ing a > complete mess of isset() checks - 5.6 has saved me a lot of what used to = be > ugly workarounds (variadic functions anyone?), but this one still haunts = me. > > I would argue for both coalesce() (as a language token) and ?? and ??=3D,= as > shorthand forms, giving the user a choice as to which they find more > readable. ?? is standard in both .NET and Apple=E2=80=99s Swift language = - Apple > added it to Swift (including the chaining behavior) early during the beta > cycle due to user demand for exactly this kind of logic, and it=E2=80=99s= been part > of C# for a long time. > > -- Gwynne Raskind > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Pete Boere Web Developer --047d7bb708e07919ea050355584b--