in reply to Re^3: 5.40 released
in thread 5.40 released

> Implicit variables, e.g. $_, are banned from my project.

Does it mean map and grep are banned, too? As is sort?

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^5: 5.40 released
by cavac (Prior) on Jun 13, 2024 at 09:02 UTC

    Basic sort is OK. Nearly all complex operations that would map, grep and sort are usually done in the database before Perl even gets its hand on the data.

    Yes, sometimes using implicit variables is, unfortunately, unavoidable because of the way some stuff is designed in Perl. But whereever possible, implicit variables are a no go.

    This is just basically part of the design guidelines i've come up for my projects, just like "always croak never die" and "use English". This may or may not make sense for someone elses projects, and i wouldn't even dare to prescribe my coding style to some random stranger on the internet.

    But for the code i bear responsibility (my own and those of my coworkers that work under me), i decided long ago that, when it comes to design and coding guidelines, i might as well run the whole thing as a dictatorship. A benevolent one, maybe. But as long as its my neck that's on the line, i can at least make sure the gallows are properly engineered to my standards, audited regularly, with the hangmans training up to date...

    Making the code easier to read and understand, even for newbies (and people that are used to other programming languages), certainly helps with making the code more robust and error free. To quote a book i read a few months ago: As a quality-control supervisor for a NASA contractor reminded his workers during the Apollo days, it takes just one “Oh, shit!” to replace a thousand well-done tasks.