[RndTbl] PHP undefined vars / array indices

Trevor Cordes trevor at tecnopolis.ca
Sat Jan 22 02:26:37 CST 2022


On 2022-01-19 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).

Of course, I do it on occasion too.  And then I debug for 15 minutes
and smack my head when I see the error.  Such is the life of a
programmer.

But it (still) has not been proven to be a security hole or massive
performance boost or great new programmer timesaver (like
hashes/dictionaries were when introduced), which are usually the
impetuses (real word!) for big backwards-incompatible changes.

I'm all for features that ease the burden on the programmer, and agree
with everything you said, but not at the expense of freedom.
Especially so when you can easily argue it boils down to a style choice.

> Regarding Perl6, totally agree it should have been "Perl++". 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. This is very ironic given the whole
> reason interpreted languages were developed in the first place was to
> make them more "human readable".
> 
> Congratulations Perl developers! You played yourself!

Yes, there are many reasons perl lost the best-glue trophy, and that's
a discussion in and of itself (which I ponder regularly).  However,
unless you're doing one-liners, most perl coders don't try to make
unmaintainable code.  We all know almost everything we write we'll go
back and tinker with in the future.  No sense shooting yourself in the
foot.

Perl is kind of the ultimate freedom in that you can code in so many
different ways.  You can make it look almost like bash if you're a bash
guy.  Or almost like C if you're a C guy.  Or almost like a real OO
(but better!) language (look up MOOSE!).  Or you can learn The Perl Way
and code to that style.  Heck, you can go 2nd order and code in ways
that would amaze most (read Higher Order Perl).  Of course, some people
would say this is the worst part of perl.  All depends on perspective.

The neat thing about perl is you can learn a bit from all of those
styles and incorporate what you like into your style, to suit your
comfort level.


More information about the Roundtable mailing list