Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99868 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20287 invoked from network); 13 Jul 2017 07:35:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jul 2017 07:35:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.221 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.221 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.221] ([81.169.146.221:31910] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/2C-01782-9A227695 for ; Thu, 13 Jul 2017 03:35:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1499931302; l=6243; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=FsY/w7IA9KwlssVok54hYcKEilCQeJDqO8knTMyxrEk=; b=KhRwgvOznl27AIZhIgfy+JcYZzzjWHDFsucvY5WrFInNFlIX6FklWS69nbP81kznGi r0YQ0XKRpDyOf9g3DKQKz74B3zHk27EE1sbF5EuW1AJ6pZYkC33SEHj960ki3zjb21R3 2rUQjQmm74wpnoEBYf52YVSdEUAt3B2yyQIkQ= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNHBqT63Q== X-RZG-CLASS-ID: mo00 Received: by mail-oi0-f52.google.com with SMTP id 191so39284994oii.2 for ; Thu, 13 Jul 2017 00:35:02 -0700 (PDT) X-Gm-Message-State: AIVw113imDaDx5mju87QhAjOvcRr+hMwa9ASumf4/sRH96M0bqi7ee1Y 3dVPKYdY0Kosg3iM8LSvbfTnCWyMWA== X-Received: by 10.202.1.209 with SMTP id 200mr1708198oib.110.1499931301492; Thu, 13 Jul 2017 00:35:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.154.177 with HTTP; Thu, 13 Jul 2017 00:35:00 -0700 (PDT) In-Reply-To: References: Date: Thu, 13 Jul 2017 09:35:00 +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="001a1137be7869e2f305542df8f9" Subject: Re: [PHP-DEV] array coalesce operator concept From: me@kelunik.com (Niklas Keller) --001a1137be7869e2f305542df8f9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > 2017-07-12 22:14 GMT+02:00 Niklas Keller : > > > 2017-07-12 17:26 GMT+02:00 Micha=C5=82 Brzuchalski < > > michal.brzuchalski@gmail.com>: > > > >> 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 > >> over > >> > 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 anothe= r > >> > level), replacing it with just a single character. I also think for > >> those > >> > 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 becau= se > >> someone didn't want to solve it. Supressing errors makes debuging very > >> hard > >> and leads to frustration. > > > > > > You have to update a whole lot of APIs before you can do that. There ar= e > > many things where it's better to ignore the warning and check the retur= n > > value and throw an exception if something is wrong. > > > > Regards, Niklas > > > > > Hi Niklas, > > could you name few of them? > Sure. fwrite and many other stream functions - https://github.com/amphp/byte-stream/blob/47775086376fd2f82fc70b3862aa82e64= a5ea667/lib/ResourceOutputStream.php#L67 openssl_x509_read - https://github.com/kelunik/certificate/blob/524fa432ed1b5f50efbe7749f3c19e2= 8a9866bc7/lib/Certificate.php#L13 > My ideal vision is catching thrown exceptions instead of suppressing > errors. > BTW it would unlock '@' for future features like use for > annotations/attributes. > We would have to make it a compile time error for quite a long time before we could reuse any operators. Regards, Niklas --001a1137be7869e2f305542df8f9--