it sounds like someone who hasn't really worked with Perl as anything more than a scripting language
It doesn't sound that way at all to me. It sounds like someone who has gotten into arguments with his co-workers about their excessive uses of $_ and other idiomatic perl that makes their code hard to read. And as others just pointed out to me, the code he's criticizing is part of the core perl distribution. | [reply] |
Just to nitpick slightly, how exactly does "idiomatic perl" make code hard to read? Isn't the definition of idomatic along the lines of "something that is easily understood"?
| [reply] |
Idiomatic is using the language in the accent of the language. The problem with this is that people unfamiliar with the idiom find it difficult to understand. Consider something like a Swartzian Transform, if you arent particularly familiar with the language just seeing it is going to make a lot of people boggle.
The above might make a lot of sense to you and me, but to some non perl programmer asked to tweak your code while you are on holidy its just gibberish.
Anyway, this is probably not the best example as the ST is a fairly standard tool in the toolbox but i think you get the idea. Just think of all those times youve managed to put some very complex logic on the lhs of a for modifier using only boolean and ternary operators.
---
$world=~s/war/peace/g
| [reply] [d/l] |
Isn't the definition of idomatic along the lines of "something that is easily understood"?
On the contrary, it refers to something to which the meaning is not immediately obvious to those not aware of the subtext.
Definition of 'idiom': 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. (...) A specialized vocabulary used by a group of people; jargon: legal idiom.
Wait! This isn't a Parachute, this is a Backpack!
| [reply] |
"Idiomatic perl" is often more like "perl that a non-expert will never be able to read." Things like map/grep tricks (Schwartzian transform, for example), lots of use of $_, typeglob manipulation, hash-slices, chaining lots of things with and/or constructs, using lots of closures... In short, things that are fine in small doses but get hard to read very quickly. Writing things out in a less compact way is usually seen as more Java/C-like and less idiomatic.
| [reply] |