5 ms·
Perl does not enforce good practices, perl does not enforce nearly anything. Which means which is a good hackers tool (isn't this HN?), but probably not very su
by blue1 17y ago
Perl does not enforce good practices, perl does not enforce nearly anything. Which means which is a good hackers tool (isn't this HN?), but probably not very suitable for your "people who don't know any better".
- jrockway 17y agoWhat language does enforce "good practices"? (You seem to think that the programming community knows what "good practices" are. I have not seen any evidence of that.)
- gaius 17y agoIt's a cultural thing. If you use an obscure feature of Perl (or Ruby, for that matter) to do a common task in a novel way the community will call you a "wizard", high praise. Do the same in Python and someone will patiently explain that the rest of the community has reached a consensus that this thing is done this way, for these reasons. Most of Perl's bad reputation (e.g. that it's a "write only" language) is simply because the community around the language reinforces that style of coding.
- jrockway 17y agoVery good point. As of late, I think Perl has gone more in the Python direction, and Ruby has gone more in the "old Perl" direction. (It is mildly amusing to watch the Ruby community make all the mistakes that Perl made 10 years ago, especially with its advocates' constant hatred for Perl.)
- pfedor 17y agoI think Perl's bad reputation comes mostly from its expressive power. People directly perceive and compare the difficulty of reading and understanding a few consecutive lines or blocks of code. Understanding 20 lines of Perl is on average more difficult than understanding 20 lines of, say, Java. The upshot is that you need much more than 20 lines of Java to implement code equivalent to those 20 lines of Perl. But this fact tends to slip your mind when you're pounding your head against the screen trying to figure out how some specific passage works.
- gaius 17y agoI'm not sure that's true. There are plenty of languages as dense as Perl (e.g. how much you can get done with just a screenful of code) but no-one says Haskell (or even Python or Tcl) is "write only" (for example).
- jrockway 17y agoSome Haskell is "write only" :) http://dev.pugscode.org/browser/src http://dev.pugscode.org/browser/src
- makecheck 17y agoYes, I think so. I recently had to explain to someone what "_" means in Perl (not to be confused with $_ or @_). It was simple for me to answer, because I had the experience. But someone seeing it for the first time wouldn't exactly be able to Google it, or look it up in a man page; who would think to look for it under "perldoc -f stat"? What's more, this particular short-cut, while useful, has a side effect: if someone maintaining the code inserts a stat on a different file in between the original stat and the "_", then the source of the "_" changes. For a single character in a script, that's a heck of a lot of barriers for a new programmer.
- gaius 17y agoPerl has demonstrated itself to be an effective tool for experienced sysadmins to write single-purpose or throwaway scripts, but applications spend most of their lives in maintenance. It it always a false economy to make things difficult for maintenance programmers, even unintentionally. Pretty much everyone I work with has been burned by being handed some legacy Perl to maintain and as a result we are very reluctant to do any new work with it. The payoff for rewriting in Python is that the technical debt incurred for using Perl in the first place is repaid.
- chromatic 17y agoI think your first paragraph contains a non sequitur. The existence of the strict and warnings pragmas, Perl::Critic, Perl::Tidy, Test::More, the size of the bundled perldoc, CPAN testers, CPANTS, et al all contribute to the maintainability of Perl 5 applications. If you choose not to take advantage of those tools when writing a Perl 5 application, you bear the risk yourself. How does that reflect on the language or the ecosystem?