Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91593 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99314 invoked from network); 9 Mar 2016 18:14:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2016 18:14:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=mtkocak@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mtkocak@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: mtkocak@gmail.com X-Host-Fingerprint: 74.125.82.51 mail-wm0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:36249] helo=mail-wm0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F2/18-53667-CF760E65 for ; Wed, 09 Mar 2016 13:14:21 -0500 Received: by mail-wm0-f51.google.com with SMTP id n186so191437030wmn.1 for ; Wed, 09 Mar 2016 10:14:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:message-id:date:to:mime-version; bh=PgSIlYntaEfCRErNkTjxDbtpLlXcGgyenwST8PyoCFk=; b=Q1L2rSXIK8vPOo0p7u55BDd/YFrUbekfg78FK/eOVCJUNMSe9OliyBw3WntAM5CrLk eZzlmomrlqgJQSrzvMQc70yeNtO+0EplU50B0K23L5ko2JPMdNlFqADRP6vM6V74qPdi v+m52SXsa2VdzNiodgPKXrZ1dCe0MQpq1CDIvCdktwfgmD9/Ope0iqmcEpJmHvWDQ5nv L/KcREmhiHGn1D78nZv/Q2uZRTKSIe3oqnYE/06EXwHWKOXDUbmyYYfOtVjV96Oxa5Fc J8q+GZjO2GIIU67lCHMyRTMrnyDD5dAQCeMDNb5GsTrDJ+b97MQrcuf6zG3gMqFHPizK 6YRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:message-id:date:to:mime-version; bh=PgSIlYntaEfCRErNkTjxDbtpLlXcGgyenwST8PyoCFk=; b=KVKx6OC9n7Pssq3Ujm30vmBXBPBVxCEiB67W4l0hAn+9GSsRjwIzGGQytWrjQUaQWw ltTfj3GGxdc0QvMW0+FDROGhM4J/tbbj0JPLhfd7f2CigyvXLwlFJvWm4hABJRRMdEdz TVyY7GmjB1gmwQB0jAFUlnrir/i1PUrHJYbxCEHNKN3UJPeMvScIEWCetjaYfxtHaQ6y G7N2DLLJzt7lAU6ydCZbLehGoPxbthxzdJw4pqfVmxwHBiQ17ku43ALnqzSktn1MIOz5 JxP1ihBePPfIXumU0cVs7alhhx5q1FY688x+PDp7LSoW6oGx9zZkz/oScf35w3ak+bQg ux+w== X-Gm-Message-State: AD7BkJL6tEYxE+gXtTguNzDFupYpaFoM4QrFD4kj4hn0C38LWqVWZef2WZcMkFGEmRryhw== X-Received: by 10.28.125.141 with SMTP id y135mr10167276wmc.83.1457547257968; Wed, 09 Mar 2016 10:14:17 -0800 (PST) Received: from [192.168.2.25] ([81.0.216.145]) by smtp.gmail.com with ESMTPSA id e14sm9519064wmi.21.2016.03.09.10.14.16 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Mar 2016 10:14:16 -0800 (PST) Content-Type: multipart/alternative; boundary="Apple-Mail=_1EDFC0B6-6376-4473-97E4-07C76266939B" Message-ID: Date: Wed, 9 Mar 2016 19:14:16 +0100 To: internals@lists.php.net Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) Subject: [RFC Proposal] Null Coalesce Equal Operator From: mtkocak@gmail.com (Midori Kocak) --Apple-Mail=_1EDFC0B6-6376-4473-97E4-07C76266939B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi all, Remember my question about ??=3D operator?=20 Forgive my rookieness and let me introduce my first RFC here: = https://wiki.php.net/rfc/null_coalesce_equal_operator = =20 Let me also include here the introduction I wrote: Combined assignment operators are around since 1970's, appearing first = in the C language. Consider the following code $x =3D $x + 3 that has = the ability to be shortened into $x +=3D 3. Hence PHP is a web focused = language, ?? operator is used to check something's existence like = $username =3D $_GET['user'] ?? 'nobody'; However due to common variable = names are much longer than $username the use of ?? self assignment, = creates repeated code. $this->request->data['comments']['user_id'] =3D = $this->request->data['comments']['user_id'] ?? =E2=80=98value=E2=80=99; = It is also intuitive to use combined assignment operator null coalesce = checking for self assignment. I am sure there would be some language mistakes, please also forgive me = for them too.=20 Currently I created a working implementation here: = https://github.com/php/php-src/pull/1795 = you can see a terminal = working with my implementation also here: http://imgur.com/zLlVFup = I hope I managed to write a simple and understandable RFC. Thank you all = for your efforts. Best Wishes, Midori Kocak Computer Scientist & Engineer / ZCPE http://www.mynameismidori.com =20= --Apple-Mail=_1EDFC0B6-6376-4473-97E4-07C76266939B--