PRO from me, for all the reasons mentioned by legoktm
On 12 February 2016 at 19:26, Legoktm <legoktm.wikipedia(a)gmail.com> wrote:
Hi,
On 02/12/2016 07:27 AM, Daniel Kinzler wrote:
Now that we target PHP 5.5, some people are
itching to make use of some
new
language features, like the new array syntax,
e.g.
<https://gerrit.wikimedia.org/r/#/c/269745/>.
Mass changes like this, or similar changes relating to coding style,
tend to
lead to controversy. I want to make sure we have
a discussion about this
here,
to avoid having the argument over and over on any
such patch.
Please give a quick PRO or CON response as a basis for discussion.
In essence, the discussion boils down to two conflicting positions:
PRO: do mass migration to the new syntax, style, or whatever, as soon as
possible. This way, the codebase is in a consistent form, and that form
is the
one we agreed is the best for readability. Doing
changes like this is
gratifying, because it's low hanging fruit: it's easy to do, and has
large
visible impact (well ok, visible in the source).
I'll offer an alternative, which is to convert all of them at once using
PHPCS and then enforce that all new patches use [] arrays. You then only
have one commit which changes everything, not hundreds you have to go
through while git blaming or looking in git log.
CON: don't do mass migration to new syntax,
only start using new styles
and
features when touching the respective bit of code
anyway. The argument
is here
that touching many lines of code, even if
it's just for whitespace
changes,
causes merge conflicts when doing backports and
when rebasing patches.
E.g. if
we touch half the files in the codebase to change
to the new array
syntax, who
is going to manually rebase the couple of hundred
patches we have open?
There's no need to do it manually. Just tell people to run the phpcs
autofixer before they rebase, and the result should be identical to
what's already there. And we can have PHPCS run in the other direction
for backports ([] -> array()).
But if we don't do that, people are going to start converting things
manually whenever they work on the code, and you'll still end up with
hundreds of open patches needing rebase, except it can't be done
automatically anymore.
My personal vote is CON. No rebase hell please!
Changing to the syntax
doesn't
buy us anything.
Consistency buys us a lot. New developers won't be confused on whether
to use [] or array(). It makes entry easier for people coming from other
languages where [] is used for lists.
I think you're going to end up in rebase hell regardless, so we should
rip off the bandaid quickly and get it over with, and use the automated
tools we have to our advantage.
So, if we're voting, I'm PRO.
-- Legoktm
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l