Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89292 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34279 invoked from network); 22 Nov 2015 09:15:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2015 09:15:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=shadda@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=shadda@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.44 as permitted sender) X-PHP-List-Original-Sender: shadda@gmail.com X-Host-Fingerprint: 209.85.220.44 mail-pa0-f44.google.com Received: from [209.85.220.44] ([209.85.220.44:36666] helo=mail-pa0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/A3-23339-2C781565 for ; Sun, 22 Nov 2015 04:15:47 -0500 Received: by pacdm15 with SMTP id dm15so161065081pac.3 for ; Sun, 22 Nov 2015 01:15:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=lcTNmvI9ZAlXDhc3v1xtzBQjKahEQggSKuiASmWTmxw=; b=FIOZUOAfw7/vQqmsvij+ObSIyNKsdQaErz6STVMZa2lKMUAobOGFK60pJs30UKpmf3 DGlvbMO54vtxUUJCyOKvgMFonR8ALVocq0EvtI2uRjMTupfVtQvoBJc12rjbuqkbl+RZ guInh29q8niQGtOcCViSgIfZaSDeESmERCfSNLgu5JA6Kr6Ubx/8l6N2GtHy8byHyfx4 GGXOizCtVg9aqIS9CnBaqa7ZyhZ/tSFGAarahC7ZfbxxqoC64BtSpG0EHV3zd9cykzaE AW4y2hrbarN89bNOfiNR2zUR+u6TDk882g/jOsKrXJiCNW/pX2tEkE9TtcxiNEIA5GMr nxTQ== X-Received: by 10.66.218.225 with SMTP id pj1mr28855134pac.40.1448183743610; Sun, 22 Nov 2015 01:15:43 -0800 (PST) Received: from [192.168.0.18] (70-36-238-3.dsl.static.fusionbroadband.com. [70.36.238.3]) by smtp.gmail.com with ESMTPSA id q70sm5612379pfa.12.2015.11.22.01.15.42 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 22 Nov 2015 01:15:42 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <4D5D4A6D-1E94-4893-B1DF-7A8C616C871A@gmail.com> Date: Sun, 22 Nov 2015 01:15:41 -0800 To: "internals@lists.php.net" Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3094\)) X-Mailer: Apple Mail (2.3094) Subject: PHP7 Coalesce operator From: shadda@gmail.com (shadda) Hey all. Been a while since I popped into this list. You may remember me = from such emails as =E2=80=9CWhy god can=E2=80=99t we have = namespaces=E2=80=9D, or =E2=80=9Cso we=E2=80=99re still not fixing = strpos, eh?=E2=80=9D I had a question-suggestion based around the cool new operator we=E2=80=99= re getting in PHP7, the ?? operator, which as I understand it is the = functional equivalent to perl=E2=80=99s // operator; in that they both = test for whether or not a variable is defined, rather than it=E2=80=99s = truthiness.=20 That=E2=80=99s all well and good, but one of the things that makes the = || operator in javascript so handy is that definedness and truthiness go = hand in hand, and an undefined value will simply evaluate to null/false, = making things like (foo || false || true) possible, which is quite handy = in a lot of situations. It seems like if we already have a construct in = place that=E2=80=99ll bypass raising an E_NOTICE, it should possible to = implement a secondary operator that tests for truthiness with similar = semantics. Something like, $config->auto_play =3D $config->auto_play ?! = $defaults->auto_play ?! false; Do you feel me? Guys? -M=