On Thu, Sep 12, 2019 at 10:43 AM Robert Korulczyk <rob...@korulczyk.pl>
wrote:

> > But, if you're dealing with a counter, then, the intent is that you are
> > going to start counting at 0 and increase it.
>
> This is not that clear as you may think. Several questions may come to
> mind when you will see incrementation of non-existing variable/key. Is it a
> bug
> and this should be initialized with a different value than 0? Maybe a
> mistake on copy&paste? Maybe a typo?
>
> One additional line will make your code much more obvious and easier to
> read and understand:
>
> $i ??= 0;
> $i++;
>

And I'm totally in favor of writing code that way. What I'm not in favor of
is breaking all of the existing code that doesn't do it that way and works
perfectly fine because some people want to FORCE everyone to write it that
way.


> Your code is not only for compiler/parser, but also for humans. Expressing
> your intentions clearly is important - the less ambiguity the better.
>
> Regards,
> Robert Korulczyk
>


-- 
Chase Peeler
chasepee...@gmail.com

Reply via email to