Jay Maynard (jmaynard) wrote,
Jay Maynard

  • Mood:
  • Music:

On scripting languages

kinkyturtle dropped a minor bombshell last night when he mentioned that he was looking to learn Perl. I don't normally think of KT as a programmer (as, I suspect, most folks don't), but occasionally I do have to remind myself that he did do Scheme while he was at Rice. (Typical Rice thing, not too connected to the real world.) For KT's purposes, it will probably serve just fine, and Randal Schwartz's book Learning Perl is as good an introduction to a programming language as any I've seen anywhere, even if the companion reference Programming Perl tends to be moderately disorganized. KT won't have to deal with that for his uses, though.

Personally, while I'm comfortable in Perl and have a fair amount of experience with it, it's not the first tool I grab out of the toolbox any more. That honor goes to Python. I find it a lot more readable and maintainable, and I think it'll be easier to learn than Perl - and won't have a major redefinition to deal with in the future, unlike Perl (Perl 6 will, supposedly, be quite different from Perl 5).

There's also another reason that affects me, but that KT won't probably have to deal with: I find CPAN (the Perl module library) to be the Linux version of Windows' DLL hell problem. CPAN modules are updated frequently, with lots of version dependencies. This wouldn't be a problem except that the maintainers break backwards compatibility fairly frequently, and so if your program depends on a module, you might find yourself having to struggle to keep up, especially if you install another program that depends on a new version of a CPAN module which, in turn, drags in a newer version of the module that you'd been depending on, often six or ten layers of dependency deep. This completely sank one project I worked on.

Python has its detractors, mostly based on the unusual block syntax it uses. In Python, block structure is expressed by indentation. Most hackers, perhaps based on a genetic dislike of FORTRAN, JCL, and other old technologies where you had to put stuff in specific columns, have a dislike for having whitespace be significant syntactically. Those same hackers, however, will indent block structure anyway as a matter of good programming practice, and all Python does is use that same mechanism as the language's actual block structuring facility. I got used to it in a hurry.

Python avoids the CPAN hell problem by including the commonly used stuff with the standard language distribution. This means that upgrading Python, or its modules, is much less of a hassle, and much less likely to break your programs.

There are still some strengths Perl has over other languages. In particular, its pattern matching and related capabilities are still unsurpassed. Even so, I'll hack around the comparative weakness in Python to get the rest of the capabilities and maintainability. To me, it's that much better overall.

  • Someone should print this poster

    In case you can't read it, it says: VINDICATION: When the loudest critic of your policies achieves his greatest success because of them. (hat…

  • Took him long enough...

    So, President Obama finally released his birth certificate. Now we can put the matter to rest. Personally, I've always thought that whether he was…

  • Fun fact for the day

    1337% of pi is 42.

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded