[Koha-devel] koha code cleaning bug?

Henri-Damien LAURENT laurenthdl at alinto.com
Mon Sep 29 22:27:49 CEST 2008


Marc Chantreux wrote:
> On Mon, Sep 29, 2008 at 12:43:52PM -0400, Joe Atzberger wrote:
>   
>> Case in point though, here I agree it is better to add a variable rather
>> than assign to $_.  But more broadly, coding to avoid $_ altogether is
>> working against the language unnecessarily and, imho, unproductively.
>>     
>
> Joe++
>
> For the moment, we have guys pro and 2 cons. Is it possible to poll and
> add it in the coding style? 
>   
I have to say I am not going in for heavy $_ use.
Anytime we can avoid this, we should.
Having implicit iterator is smart and looks bright.
But it really has to be very carefully written AND documented.

For instance if you are processing a string inside a loop of strings 
with a $_ and uses m//
on an element, will the reader be able to know what should be in $_ 
after a m// is applied ?
Sometimes, when we are debugging, things are getting tough because many 
ppl added many features in one loop that could/should have remained simple.
I had to write many maps inside foreach, and the first time, I wanted to 
use
foreach (@array_of_arrayrefs){
   map{$_ }@$_;
}
Then use of $_ as iterator was rather a burden than a good thing.

I donot think that using $_ will really ease the process.
Maybe only with maps and greps, but in for/foreach/while loops, I donot 
see any good in this.

My 2 cts.
-- 
Henri-Damien LAURENT



More information about the Koha-devel mailing list