Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77307 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66293 invoked from network); 18 Sep 2014 11:42:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Sep 2014 11:42:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.208 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.208 imap2-3.ox.privateemail.com Received: from [192.64.116.208] ([192.64.116.208:59080] helo=imap2-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A3/80-63310-905CA145 for ; Thu, 18 Sep 2014 07:42:02 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id A0B148C0081; Thu, 18 Sep 2014 07:41:58 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id lqRjFDC8jurR; Thu, 18 Sep 2014 07:41:58 -0400 (EDT) Received: from oa-res-27-90.wireless.abdn.ac.uk (oa-res-27-90.wireless.abdn.ac.uk [137.50.27.90]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 74CF68C007D; Thu, 18 Sep 2014 07:41:55 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Thu, 18 Sep 2014 12:41:52 +0100 Cc: Gwynne Raskind , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <54E82419-931D-4F9E-8115-175EA1BDC970@darkrainfall.org> To: Pete Boere X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] Implicit isset() in Shorthand Ternary Operator From: ajf@ajf.me (Andrea Faulds) On 18 Sep 2014, at 12:32, Pete Boere wrote: > I'm seeing '??' as analogous to the way JS developers use '||', and I = use > that all the time when writing JS. PHP already has a direct equivalent to ||, namely the ?: operator. = However, unfortunately PHP always spits out a notice on non-existent = indices, unlike JS which just results in undefined, so we need to add a = special operator to silence it. > 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. We could use a function *syntax*, though, but I don=92t like this idea. = coalesce() and ifsetor() are both ugly to me, and it=92s not super = obvious what they do: var_dump(coalesce($_GET[=91foobar=92], 3)); vs. var_dump($_GET[=91foobar=92] ?? 3); ?? also has the advantage of being shorter. > Also, not much sure about a '??=3D', perhaps it should be a followup = RFC > should '??' be accepted. It=92d make sense to do it within this RFC if possible. If it seems too = controversial, it could always have a separate vote within the RFC. -- Andrea Faulds http://ajf.me/