Re: [PHP-DEV] [RFC][VOTE] Deprecate curly brace syntax for accessingarray elements and string offsets

This is only part of a thread. view whole thread
  106136
July 3, 2019 15:59 nikita.ppv@gmail.com (Nikita Popov)
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
  106138
July 3, 2019 17:22 claude.pache@gmail.com (Claude Pache)
> Le 3 juil. 2019 à 17:59, Nikita Popov 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
  106145
July 4, 2019 22:22 bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=)
Den 2019-07-03 kl. 19:22, skrev Claude Pache:

> >> Le 3 juil. 2019 à 17:59, Nikita Popov 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
  106139
July 3, 2019 19:32 theodorejb@outlook.com (Theodore Brown)
On Wed, July 3, 2019 at 10:59 AM Nikita Popov ppv@gmail.com> wrote:

> 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.
I did some additional analysis on the output of Nikita's script. The number of curly brace usages is inflated somewhat due to duplicate packages. For example, tecnick.com/tcpdf and tecnickcom/tcpdf both have 74 usages, and are the same project which was renamed. Likewise, johnpbloch/wordpress-core and roots/wordpress each have 182 usages, and they are both mirrors of the WordPress core codebase. Another example is magento/zendframework1 which was forked from zendframework/zendframework1 (almost half the curly brace usages have been removed in the magento fork). 53 out of 89 total packages using the curly brace syntax use it 4 or fewer times. 92% of the usages in are in just 25 unique projects. You can view my script and its output here: https://gist.github.com/theodorejb/ba35fc8f72df8823e07c5f3b51870e00 Best regards, Theodore