Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99865 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93338 invoked from network); 12 Jul 2017 20:14:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Jul 2017 20:14:34 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.160 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.160 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.160] ([81.169.146.160:21495] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/5A-01782-92386695 for ; Wed, 12 Jul 2017 16:14:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1499890470; l=3685; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=dTzl1iNmwuyUmrx9wEaSeRL0X4jhLQ+N3zvwxODyyok=; b=C7hLvlr99RD4EoiIvn5/5z5vZ5hL8dve5ZXR9MU7LCsbwyyy3S0cq2WnzBAPpFbuP6 dgHEcpUYzEFOsTsgVGJBD9FVRqzSfLyiMcECd5lDMLflHyng9X3H4eLZRtP5i69/tRpc cVzN1rllmmBV7IjR/DYbGCETtcZt71l9N3/2g= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNHBqX53Q== X-RZG-CLASS-ID: mo00 Received: by mail-oi0-f41.google.com with SMTP id 191so29371717oii.2 for ; Wed, 12 Jul 2017 13:14:30 -0700 (PDT) X-Gm-Message-State: AIVw110tXOuUwdDZz6Gob9NOKCOsO500EnqkouyLXy64UANRV12b9Lqt am9BVZjPCf8yqcPG3nY33cIrHMbxVg== X-Received: by 10.202.78.15 with SMTP id c15mr239681oib.203.1499890469613; Wed, 12 Jul 2017 13:14:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.154.177 with HTTP; Wed, 12 Jul 2017 13:14:29 -0700 (PDT) In-Reply-To: References: Date: Wed, 12 Jul 2017 22:14:29 +0200 X-Gmail-Original-Message-ID: Message-ID: To: =?UTF-8?Q?Micha=C5=82_Brzuchalski?= Cc: Mark Shust , Rowan Collins , PHP Internals List , Aidan Woods Content-Type: multipart/alternative; boundary="001a11c164a8a4bd8405542476dc" Subject: Re: [PHP-DEV] array coalesce operator concept From: me@kelunik.com (Niklas Keller) --001a11c164a8a4bd8405542476dc Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2017-07-12 17:26 GMT+02:00 Micha=C5=82 Brzuchalski : > 12.07.2017 15:35 "Mark Shust" napisa=C5=82(a): > > > > Hi Aidan, > > > > I think you are correct on all points. The initial emit is just a > warning, > > so I think a suppressor will work just fine, since it does just pass ov= er > > the foreach if a traversable isn't passed in. > > > > I could see this being helpful as it makes wrapping an if block around = a > > foreach not needed anymore (and in turn indenting the foreach another > > level), replacing it with just a single character. I also think for tho= se > > that use linting tools and flag error suppressions, that an @as > definition > > could be easily ignored from such a linter. I develop with warnings on, > and > > see error suppressions as a sort of code smell, however I think the @as > > definition could be really useful. > > IMHO the whole error supression and its operator should be deprecated and > removed from language. Supressing errors is just hiding problems because > someone didn't want to solve it. Supressing errors makes debuging very ha= rd > and leads to frustration. You have to update a whole lot of APIs before you can do that. There are many things where it's better to ignore the warning and check the return value and throw an exception if something is wrong. Regards, Niklas --001a11c164a8a4bd8405542476dc--