Why I don't write in Pascal

A friend, Ido (ik_5) put up a post (in Hebrew) about the last TA.pm meeting, and although he misspelled my moniker twice, he raises two interesting points.

First of all, he complains about being mocked when everyone introduced themselves and he said he works with Pascal. Secondly, he asks why don't people program in Pascal? What's so bad about it?

So, apologies have to go to people you've offended. Even if you didn't mean to, even if they didn't get a joke you thought you were sharing. When feelings are hurt, it's time to pause and apologize. So, hopefully Ido is reading this and might be less upset now.

It's also important to note, once we've cleared the air, that at meetings (whether Perl, OSDC, FOSDEM, PyWeb, or any other technical conference), I think the humor flows more. For example, at a Linux conference, Gentoo Linux received an unassembled Ikea chairs set, to assemble on their own while the rest got chairs. I love Gentoo and if I were representing them there, I'd laugh it out. Then again, I'm not everyone. The point is, we feel more comfortable to poke each other. Perhaps sometimes too much.

On to more interesting issues, I've asked people (especially at the last Top Posters meeting) why they aren't using Pascal, to try and answer Ido.

I've received a lot of answers, some of which were about job security, some of which were about the fun, some about the community, some even complained about the feeling in Pascal that there is only one editor, one compiler, one solution, even if untrue.

The two most interesting answers came from a friend, and co-worker, Tamir Lousky. When I asked him, his reply was simple, at first: "CPAN". CPAN is such a wide, amazing resource, by any standard, which makes your work easier, more fun and enjoyable and definitely more productive. It also emphasizes community very strongly, connecting people by interest (and sometimes, even work). It is a resource that isn't easily matched by other languages, and that includes Pascal.

The second answer is something I personally relate to even more, the flexibility of the language. Truly, you cannot understand the elasticity of the Perl programming language until you work heavily with it. While I have a few years of experience with it, and I have written quite a few modules with a good amount of work-code, I've still touched just the surface of the language's abilities and indeed, flexibility is a language virtue that is often overlooked.

What are your reasons for not using Pascal? Or, even, what are you reasons for sticking with Perl?


I have not done any serious programming in Pascal, so cannot comment on it.

With regards to Perl the reason I have stuck with Perl is the very small time it took me to build my first non-trivial application. I did not have to spend days or weeks trying to wrap my head around the language but just got on with the job.

However as time passes and I understood more and more of the language I am writing very different(and if I may say so myself, better) code while being even more productive(enter CPAN). The fact that Perl allows programmers of different skills and experience levels to be (almost)equally productive is simply amazing.

I should probably also talk to Ido and besides apologizing I should give my explanation:

Most of just don't know anything about Modern Pascal. Those of us who used in 10-20 years ago (OMG) probably think it is old. Some of us might have bad experiences with it. You know, some of the same stuff we hear about Perl.

I personally don't use Pascal so I have no idea what repository they have. Maybe it is bigger and better than CPAN. Maybe they have much better solutions to a lot of things I work on.
I don't know as I just don't hear about that.

Does any of this sound familiar from a Perl POV?

I don't program in Pascal for the same reason that I don't program in Perl anymore: type inference. Perl and Pascal don't have type inference and that is just not acceptable for me these days. I don't want to mess around with types unless I absolutely must. I want to see your algorithm not the types over which it runs.

The most terrible aspect of Pascal as I know it is exactly what Perl is good at: strings. The reason for this is the type system. Strings in Pascal are exactly equivalent to arrays of characters – which is bad because the type of an array in Pascal includes its length. What this effectively means is that if you declare a function that takes a String[255] parameter, it takes monkey-work to pass it the value of a String[40] variable because the type of the variable is incompatible with the type of the parameter.

They may have remedied this in more modern dialects of the language after I stopped writing Pascal, but it’s a massive pain in the more classic flavours. (And I used Turbo Pascal, which was much less painful than the original language already.) 255 characters is also the maximum length of a string in the dialects of that vintage (and may still be in the newer ones due to back-compat concerns, I don’t know). It cannot be overstated how much of a hassle that made it to do any sort of text munging.

I hear that Delphi (if that is what he is using) has almost nothing in common with classic Pascal any more, though.

My criteria to program in X or use software Y can pretty much be boiled down to:

1. Is it going to get the job done?

2. How much effort is it going to require to use?

3. How fun will it be?

With those three criteria weighted in function of any specific project's needs.

In the case of Pascal, I have very fond memories of it (and of its cousin, Modula-2), but in the last 12 years didn't come across anything where I wouldn't be better served by C, Java or Perl. But given a situation where it would make sense, I would use it without batting an eyelash. Heck, on the same premises, I would -- and did in the past -- use VBasic as well. Although in the latter case I'd probably curse under my breath the whole time. ;-)

Lists. Lists lists wantarray lists lists. The default return value of (undef) is so flexible I can barely stand it.

I've no idea why other languages don't have seemless integration of lists..er..integrated into their syntax. Every time I spend time with another language, I'm generally left frustrated with the lack of ability to chain multiple seemingly unrelated calls into one eloquent work of art due to someone, somewhere, not thinking lists are the most amazing thing, ever.

Sawyer X,

Thank you for raising the issue of people being offended / mocked and so on.

It sadly happens all the time, on IRC channels, in web forums.
It happens in the Perl community.
It seems to be almost part of the culture. :-S

In Perl land I see ugly PHP-bashing by some people as well as a constant undertone of arrogance by some. (Well, it comes over to me as that.)
And of course (sometimes unfriendly) jokes you only get with a solid understanding of the English language.

Imho "go rtfm wtf" and the like are not applicable in a community. You can - without loosing any time - point that person to the respective documentation or ignore a question if someone repeatedly seems to ask without thinking.

It cannot be assumed that someone asking a stupid question or having made a conclusion that sounds silly to others has not thought the thing over. Perhaps he / she has also googled but without success.

Even if you have to dismiss somebody, it should be done politely.

So, it's good to honestly apologize. Nobody is perfect.

I would like to thank all the people offering their help and time; I would like to thank for their patience to answer the same questions over and over. For their friendliness.

I could say all this much better in my own language.. With the disadvantage that most of you wouldn't understand it.
I hope I haven't offended anybody inadvertently.

My experience with Pascal matches Aristotle's. I wouldn't necessarily make fun of someone who was working in Pascal, but I might look at them funny and ask them why.

In addition to it's crippled string handling, Pascal was famous for trying to pretend that the outside world didn't exist: doing any sort of input or output was a non-standard extension. That's the polar opposite of something like perl, and none of the post perl languages would try to get away with that.

Back when I was getting started as a programmer, the computer intelligensia were pushing the idea that we were going to save the world with Structured Programming in Pascal. Pascal turned out to be such a useless language that everyone veered in the other direction and started working largely in C (and consequently we had a few decades of memory leaks and buffer overflows).

Myself, I've never trusted that intelligensia ever again-- the computer field is incredibly faddish, full of people who claim to know everything but often have little more than a guess to back it up. And that's why I'm a perl programmer and not a member of the language of the month club.

Leave a comment

About Sawyer X

user-pic Gots to do the bloggingz