On Thu, Sep 12, 2019 at 10:06 AM Arvids Godjuks <arvids.godj...@gmail.com>
wrote:

>
>
> чт, 12 сент. 2019 г. в 16:02, Chase Peeler <chasepee...@gmail.com>:
>
>> On Thu, Sep 12, 2019 at 9:55 AM Claude Pache <claude.pa...@gmail.com>
>> wrote:
>>
>> >
>> >
>> > > Le 12 sept. 2019 à 15:33, Marco Pivetta <ocram...@gmail.com> a écrit
>> :
>> > >
>> > > $foo[$key1][$key2] = ($foo[$key1][$key2] ?? 0) + 1;
>> > >
>> > > Marco Pivetta
>> >
>> > That violates blatantly DRY (twice the exact same lengthy expression
>> > `$foo[$key1][$key2]`), so it is not a satisfactory solution.
>> >
>> > And that's why PHP is so awesome. You don't have to do all these stupid
>> tricks just to do something simple like increment a counter. But, it looks
>> like we're going to throw that out of the window because some people think
>> that since they like doing it like the way above, everyone should have to.
>>
>> > —Claude
>> >
>> >
>>
>> --
>> Chase Peeler
>> chasepee...@gmail.com
>>
>
> Easy, because experience shows that leads to bugs and lots of them.
> Security issues even.
> If you want to write predictable code - you have to init your
> variables/arrays. And check for existence/null. If fixed at least a few
> dozen bugs in my system I took over in the last few months specifically
> because of undefined variables or indexes.
>
> Never once have I advocated not initializing variables or arrays. I'm just
saying that we shouldn't force such behavior. Many of us can figure out
when we need the extra boilerplate and when we don't. Don't force us to
have to deal with the additional burden in every single case because
someone else can't.


> It works for small stuff, but when you have a codebase with 100+k LOC and
> more, you have to go strict or it starts to cost a lot of money and
> personnel to keep things running along.
>
> --
> Arvīds Godjuks
>
> +371 26 851 664
> arvids.godj...@gmail.com
> Skype: psihius
> Telegram: @psihius https://t.me/psihius
>


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

Reply via email to