Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101716 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66921 invoked from network); 28 Jan 2018 06:55:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jan 2018 06:55:06 -0000 Authentication-Results: pb1.pair.com header.from=markus@fischer.name; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=markus@fischer.name; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fischer.name from 84.116.36.20 cause and error) X-PHP-List-Original-Sender: markus@fischer.name X-Host-Fingerprint: 84.116.36.20 vie01a-dmta-pe08-1.mx.upcmail.net Received: from [84.116.36.20] ([84.116.36.20:10070] helo=vie01a-dmta-pe08-1.mx.upcmail.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 76/23-24062-5C37D6A5 for ; Sun, 28 Jan 2018 01:55:01 -0500 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1efgri-0002aw-5X for internals@lists.php.net; Sun, 28 Jan 2018 07:54:58 +0100 Received: from mail02.home ([213.47.8.56]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 3iuu1x01j1CY7x901iuv4c; Sun, 28 Jan 2018 07:54:56 +0100 X-SourceIP: 213.47.8.56 Received: from mail02.home ([192.168.1.14] helo=[IPv6:::1]) by mail02.home with esmtp (Exim 4.72) (envelope-from ) id 1efgrd-0005lm-NS for internals@lists.php.net; Sun, 28 Jan 2018 07:54:54 +0100 To: internals@lists.php.net References: <517F0F7B-CD01-4F35-9021-8336B7BA06E1@cschneid.com> <39BA1B12-D1EB-4348-8DD6-FE73B22047D8@cschneid.com> Message-ID: <081cd532-b816-60b2-8a84-cab724a319d9@fischer.name> Date: Sun, 28 Jan 2018 07:54:53 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <39BA1B12-D1EB-4348-8DD6-FE73B22047D8@cschneid.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-Spam_report: Spam detection software, running on the system "scanner01.home", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hi, On 28.01.18 03:51, Christian Schneider wrote: > 2) More importantly: It hides the variable being used: 'src' instead of $src which makes it harder to search for the variable or statically analyse the code. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: Re: [PHP-DEV] Shorthand proposal for associative arrays From: markus@fischer.name (Markus Fischer) Hi, On 28.01.18 03:51, Christian Schneider wrote: > 2) More importantly: It hides the variable being used: 'src' instead of $src which makes it harder to search for the variable or statically analyse the code. I'm not sure about that argument. compact() been around basically since forecer. Modern PHP IDEs do support this already and I'm pretty sure static analyzers do too (I now for a fact that both PhpStorm and phpstan support it). In contrast, I've this argument: With compact() you have a clear call acting as a boundary when such a behaviour is used. Use the direct-variable syntax doesn't give you that because you would at least know the name of a variable or apply regular expression for such but I bet you can't easily use any tool at hand like you could with compact. Is this _more_ relevant than your arguments? I'm not to judge :) But I too believe compact() serves well and covers everything and the proposal is one more thing to put alternative syntax for something already possible. I also weight that it's practical impact is much more less then compared to e.g. the coalesce operator. That ons is also just syntax sugar but it really made an impact to the language because that pattern is very very common. I don't think this applies to compact(); it only has very special use-cases (and it's not only templating…), I see it in almost every project I work and (and use it myself) and I never felt something "fix-worthy" with it. - Markus