in reply to Idioms considered harmful

dictionary.com gives 5 meanings for idiom:
  1. A speech form or an expression of a given language that is peculiar to itself grammatically or cannot be understood from the individual meanings of its elements, as in keep tabs on.
  2. The specific grammatical, syntactic, and structural character of a given language.
  3. Regional speech or dialect.
    1. A specialized vocabulary used by a group of people; jargon: legal idiom.
    2. A style or manner of expression peculiar to a given people: “Also important is the uneasiness I've always felt at cutting myself off from my idiom, the American habits of speech and jest and reaction, all of them entirely different from the local variety” (S.J. Perelman).
  4. A style of artistic expression characteristic of a particular individual, school, period, or medium: the idiom of the French impressionists; the punk rock idiom.

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