sense 1. seems like it could apply to code that is difficult to understand but in fact it cannot apply: the meaning and action of any piece of perl code is always able to be discerned from the individual elements (if one understands those elements thoroughly enough)- take a look at Re: camel code (SPOILERS!) for an example :) If it can be run by perl (the program) then it can be understood. I am not saying it is OK to write production code that is unclear or obfuscated, just that the word "idiomatic" is the wrong word to describe such code.
sense 2. As Abigail-II pointed out this is what is usually meant by idiom when discussing programming languages. I used to occaisionly resort to wrapping perl 1 line filters in shell code because I didn't have the perl in-place edit idiom in my tool kit. I have seen quite a bit of perl code which I have been able to say (with some accuracy) if the coder was a shell or C or "other" programmer. If you are not using Perl idioms then what language are you programming in?
senses 3-5 don't really apply to programming.
I'm not sure what the connection between idiomatic perl and cargo cult programming is supposed to be. The idiomatic perl solution would generally be a briefer and more concise version of the non-idiomatic version, which is opposite to the cargo cult method of "ritually including code which serves no real purpose". I ritually include cgi.pm in my cgi scripts (without attempting to understand cgi.pm), that is not cargo cult programming because cgi.pm serves a purpose and there are good reasons why it is better than other solutions.
Does obfuscation belong in production code? Definately not. Where is the line between obfuscation and a language idiom? I'm not entirely sure :) If in any doubt comment or re-code clearer.
--
Life is a tale told by an idiot -- full of sound and fury, signifying nothing. William Shakespeare, Macbeth
In reply to Re: Idioms considered harmful
by greenFox
in thread Idioms considered harmful
by rinceWind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |