pozorvlak (pozorvlak) wrote,
pozorvlak
pozorvlak

Ten things I hate about Perl

brian d. foy says that you can't be an effective advocate for a language unless you can think of five things that you hate about it off the top of your head, the reason being that if you can't, then you don't know enough about the language to advocate it effectively. So, just to go one (or five) better, here are ten things I hate about Perl.
  1. References. I don't have anything like as many problems with the syntax (which is baroque, even by Perl standards) as I used to, but I still don't like it. And really, why do we even have references? Some things returning/accepting listrefs and some things returning/accepting lists is a fertile source of pain, and the whole business is unpleasantly typeful. And yes, I know that making deeply-nested data structures mildly painful to use helps to avoid Lisp Programmer's Disease, but is the cure really better than the disease in this case? Overall, I think Python handles this a lot better.
  2. Lexical scope is not the default.
  3. File::Find's interface is terrible: almost as bad as that of find(1), which is my least favourite Unix utility.
  4. Parse::RecDescent isn't in the standard distribution. Actually, the choice of bundled modules is another thing the snakeheads do better, I think.
  5. Sigils. I understand why the 12th* (edit: 13th - thanks, anonymous troll!*) element of @i is $i[12], but it makes the language hard to teach - lots of people who might otherwise get a lot out of the language think "What? That's totally bogus!" and stop there. And having four separate namespaces, distinguished by the initial characters of symbols, is unpleasantly Fortranish (Fortranian? Fortroid? Ah, that's the one).
  6. OO requires either writing unnecessary boilerplate (all the bless $self, $class business) or using one of the various CPAN modules out there to make this easier. Yes, it's great that the guts of the OO mechanism are exposed, and that you can write such modules, but it would be great if there were an easier, standard way of just writing a class!
  7. Lack of named argument parameters, other than by explicitly deconstructing @_. No biggie, I suppose, but it irks me.
  8. map and grep don't accept coderefs. Or rather, they do:
    $f = sub { $_[0] + 3 }; print map $f, 0 .. 3
    CODE(0x8167900)CODE(0x8167900)CODE(0x8167900)CODE(0x8167900)
    Bugger. What I meant, of course, was
    $f = sub { $_[0] + 3 }; print map $f->($_), 0 .. 3
    3456
    Note that reference syntax there. What's really going on is that map and grep take blocks or expressions, not functions. map chr, 70 .. 73 works, but that's because if chr isn't given any arguments it defaults to $_. I suppose this makes sense, but it's not how I think of map, and it's not how it works in most languages. Maybe I've been spending too much time with functional languages.
  9. No laziness. I have been spending too much time with functional languages. Of course, you can get many of the benefits of laziness with iterators, but it's more work. Note also that the <> operator is effectively lazy input-reading. Unless you want it not to be.
  10. Perl 6 (which promises to fix most of the complaints above) is taking so long to arrive! :-(

This is not to say that I hate Perl: far from it. I think it's a wonderful, fun language, with a great community around it, producing some insanely cool software (CPAN might be considered the world's premier laboratory for module and language-extension design). I am continually surprised that Perl has such a bad press, and gets such short shrift from the language-design community. You might expect that a language that breaks almost every accepted precept of language design would simply be a bad language, and no fun at all to use. Yet Perl does this, and has a fanatical community of users, some of them truly excellent hackers. This, it seems to me, is a datum point of enormous importance.

But anyway, I'd like to ask this question to the hackers reading this. What five things do you hate most about your favourite language?

* Unless you've set $[ to 1 - thanks, paddy3118!
Tags: beware the geek, computers, hate, ideas, perl, programming, rants
Subscribe

  • PSA: Working Effectively With Legacy Code by Michael Feathers

    I am only about a hundred pages into this book, but it had paid for itself after fifty. I wish I'd read it ten years ago. Actually, I wish I'd read…

  • Fuck mixer taps

    !markdown We've recently moved house, to a refitted Victorian tenement flat in Leith. We're renting it from a lovely couple from Continental Europe,…

  • Srelipmoc ni esruoc tsrif a

    If I ever design a first course in compilers, I'll do it backwards: we'll start with code generation, move on to static analysis, then parse a token…

  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 19 comments

  • PSA: Working Effectively With Legacy Code by Michael Feathers

    I am only about a hundred pages into this book, but it had paid for itself after fifty. I wish I'd read it ten years ago. Actually, I wish I'd read…

  • Fuck mixer taps

    !markdown We've recently moved house, to a refitted Victorian tenement flat in Leith. We're renting it from a lovely couple from Continental Europe,…

  • Srelipmoc ni esruoc tsrif a

    If I ever design a first course in compilers, I'll do it backwards: we'll start with code generation, move on to static analysis, then parse a token…