Re: [RFC][VOTE] Deprecate curly brace syntax for accessing array elements and string offsets

From: Date: Thu, 04 Jul 2019 22:22:20 +0000
Subject: Re: [RFC][VOTE] Deprecate curly brace syntax for accessing array elements and string offsets
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-106145@lists.php.net to get a copy of this message
Den 2019-07-03 kl. 19:22, skrev Claude Pache:
Le 3 juil. 2019 à 17:59, Nikita Popov <nikita.ppv@gmail.com> a écrit : On Wed, Jul 3, 2019 at 4:41 PM Levi Morrison <levim@php.net> wrote:
Was any analysis of usage done for top open source projects? I support this direction, but would prefer to know its current impact before voting.
I checked top 2k projects with a 2-3 months outdated data set. Here is the analysis log: https://gist.github.com/nikic/b5f811e0423bf051f4492cd6e0c0273e Overall there were ~2.2k individual uses of alternative array syntax. To put that into context, there 888.3k total array accesses in the data set, which puts usage at about 0.25%. Uses are usually clustered, i.e. if alternative array syntax is used in a file, it will be used many times. Nikita
It ought to be noted that the alternative syntax is used essentially for strings, not for arrays proper. In fact, I expect that it is used almost exclusively for strings. That means, most probably: ~2.2k uses of alternative syntax for direct byte access in strings among 888.3k for byte access in strings AND direct element access in arrays. —Claude Hi,
Would it be possible to compare the string access only for both curly & straight braces and the same for array access? r//Björn L

« previous php.internals (#106145) next »