[RndTbl] PHP undefined vars / array indices

Brian Lowe muug-mail at groupbcl.ca
Wed Jan 19 18:35:01 CST 2022


On Wednesday, January 19, 2022 9:08:52 A.M. CST John Lange wrote:

> I submit that in the non-declarative case you can easily spend a ton of
> time trying to trace the logic in the lower section of code without
> realizing your mistake (been there, done that).

At the risk of adding fuel to a fire, I agree with this. I'm a Perl fan myself, and I always add "use 
strict;" to my code. I appreciate the compiler telling me that it hasn't seen 
"very_long_variab1e_name" before (did you notice I dropped the changed the "l" to a "1" in 
"variable"?)

> Regarding Perl6, totally agree it should have been "Perl++".

Perl 6 does have a new name now; it was renamed to "Raku" in October 2019: https://
www.raku.org.

> But in IMHO
> Perl dropped out of favour because of a point I made earlier, it is very
> often unreadable and therefore hard to learn and maintain. This is made
> worse by the fact that Perl programmers take pride in writing the most
> unreadable code possible (there is even a contest for this) and then look
> down their noses at less "expert" programmers who struggle to understand.

Very much this! There's a great temptation in Perl to play "code golf." I admit it feel cools to 
take a nicely nested if/then/else with a loop and turn it into:

> @var = map { condition ? yes : no } sort grep { /regexp/ } @var;

It looks neat and is nice and concise, but maintainable? Not so much. These days I shy away 
from doing that even in code I write for my own use.

Brian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://muug.ca/pipermail/roundtable/attachments/20220119/ff2a16f5/attachment.htm>


More information about the Roundtable mailing list