Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106776 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 465 invoked from network); 28 Aug 2019 23:49:47 -0000 Received: from unknown (HELO S15-GW102.mycloudmailbox.com) (207.126.101.39) by pb1.pair.com with SMTP; 28 Aug 2019 23:49:47 -0000 Received: from relay301.mycloudmailbox.com (unknown [207.126.101.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by S15-GW102.mycloudmailbox.com (Postfix) with ESMTPS id 46Jdwn6zngz2SmZs; Wed, 28 Aug 2019 17:22:01 -0400 (EDT) Received: from S14-MBX11-11.S14.local (10.40.132.17) by S15-MBX101.S15.local (10.40.140.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 28 Aug 2019 17:21:59 -0400 Received: from S14-MBX11-16.S14.local (10.40.132.58) by S14-MBX11-11.S14.local (10.40.132.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1779.2; Wed, 28 Aug 2019 17:21:58 -0400 Received: from S14-MBX11-16.S14.local ([fe80::bcf9:6b77:6b88:14bb]) by S14-MBX11-16.S14.local ([fe80::bcf9:6b77:6b88:14bb%15]) with mapi id 15.01.1779.002; Wed, 28 Aug 2019 17:21:58 -0400 To: Matthew Brown , Stanislav Malyshev CC: Zeev Suraski , PHP internals Thread-Topic: [PHP-DEV] [RFC] Reclassifying engine warnings Thread-Index: AQHVXYO360plzvpkckuBk/picZEElKcQ4AkAgAAq0QCAAAbxgIAAE/iAgAAPvgCAAAlMAIAAE82A//+9xHk= Date: Wed, 28 Aug 2019 21:21:58 +0000 Message-ID: References: <6ed74ae0-5feb-39de-a39a-f9a8f80401b2@gmail.com>,<342BB5DE-80D0-405E-8C71-D959F38D17E8@gmail.com> In-Reply-To: <342BB5DE-80D0-405E-8C71-D959F38D17E8@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.40.134.254] x-routingagent: Treated Content-Type: multipart/alternative; boundary="_000_fdb9367ab4fc40438d136bc0201820f5proposaltechcom_" MIME-Version: 1.0 X-CrossPremisesHeadersFilteredBySendConnector: S15-MBX101.S15.local X-OrganizationHeadersPreserved: S15-MBX101.S15.local Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: truth@proposaltech.com (Todd Ruth) --_000_fdb9367ab4fc40438d136bc0201820f5proposaltechcom_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable > If we want PHP to be as easy as possible then $nullref->bar(), $foo->some= Undefined(), > new UndefinedClass etc shouldn=92t be exceptions either - they can just b= e notices. That's very different. Note that this code doesn't even generate a notice: $x =3D null; var_dump($x+1); I'm joining the thread to point out another way to avoid the notice in hope= s that this way doesn't get deprecated or somesuch: $temp =3D& $never_defined; // No notice :) $temp++; // Happily becomes 1 if $never_defined wasn't defined unset($temp); // so we don't unintentionally make more changes with $temp = later Our code predates "??" and we use the above boilerplate in many, many place= s, but it isn't boilerplate enough to easily search and replace. - Todd > On Aug 28, 2019, at 4:01 PM, Stanislav Malyshev wro= te: > > Hi! > >> Javascript has treated undefined variables as a catchable exceptions sin= ce >> (I think?) forever. > > Which seems to be why I open a random Javascript file in our codebase > and see this: > > var wikibase =3D wikibase || {}; > wikibase.queryService =3D wikibase.queryService || {}; > wikibase.queryService.ui =3D wikibase.queryService.ui || {}; > wikibase.queryService.ui.toolbar =3D wikibase.queryService.toolbar || {}; > > wikibase.queryService.ui.toolbar.Actionbar =3D ... > > (not my code but I've seen it a lot) > IMHO, this is language getting in a way and people writing boilerplate > to avoid "service" that is not actually needed. > >> much work. This means its developers often don't improve much either, wh= ich > > I don't think PHP should be a language that "builds character" by > forcing people to do more work than it's necessary for them, in order > for them to "improve". I think it should be as easy as possible, and if > somebody wants to learn how the bits move, one can always pick up a good > book or go to a Coursera course, etc. > > -- > Stas Malyshev > smalyshev@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php --_000_fdb9367ab4fc40438d136bc0201820f5proposaltechcom_--