Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106772 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 86301 invoked from network); 28 Aug 2019 22:55:47 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 28 Aug 2019 22:55:47 -0000 To: internals@lists.php.net References: <5d668ea6.1c69fb81.6921b.bb41SMTPIN_ADDED_MISSING@mx.google.com> Date: Wed, 28 Aug 2019 21:28:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Posted-By: 94.4.34.143 Subject: Re: [PHP-DEV] [RFC] Reclassifying engine warnings From: markyr@gmail.com (Mark Randall) Message-ID: On 28/08/2019 20:48, Stanislav Malyshev wrote: > Sure, that works. But I don't see any way this clunker is better than > $counts[$key]++ Because it's explicit, and incrementing null is mathematically unintuitive. After all, null does not exist anywhere in the set of natural numbers, so Roman etymology aside, adding 1 to it shouldn't magic it into a completely different type without some explicit cast. ?? Let's you go "I know this index may not exist, if it doesn't, use 0 instead". No funky type coercions that are in no way apparent from looking at the code. To use the analogy someone posted elsewhere... the training wheels are coming off. Time to be responsible and type those few extra characters to be clear on your intent. -- Mark Randall