Slashdot Mirror


Ask Slashdot: Is Pascal Underrated?

An anonymous reader writes In the recent Slashdot discussion on the D programming language, I was surprised to see criticisms of Pascal that were based on old information and outdated implementations. While I'm sure that, for example, Brian Kernighan's criticisms of Pascal were valid in 1981, things have moved on since then. Current Object Pascal largely addresses Kernighan's critique and also includes language features such as anonymous methods, reflection and attributes, class helpers, generics and more (see also Marco Cantu's recent Object Pascal presentation). Cross-platform development is fairly straightforward with Pascal. Delphi targets Windows, OS X, iOS and Android. Free Pascal targets many operating systems and architectures and Lazarus provides a Delphi-like IDE for Free Pascal. So what do you think? Is Pascal underrated?

33 of 492 comments (clear)

  1. Modula-3 FTW! by Anonymous Coward · · Score: 5, Funny

    begin
    Pascal should die!
    end

    1. Re:Modula-3 FTW! by halivar · · Score: 4, Funny

      It's ok! I got you covered! Wait... crap!

    2. Re:Modula-3 FTW! by ShanghaiBill · · Score: 5, Insightful

      The problem with Pascal is not that it is bad, but that it provides nothing of value to offset the cost of maintaining a separate toolchain, training programmers, building libraries, etc. What can you do in Pascal that you can't do in C++, or Python, or Java? Why do we need yet another language, that has no particularly useful features?

      I used Pascal in some college courses, and felt that my productivity went down by about 50% compared to C, just because of all the extra typing, and the reduced readability: begin using words for punctuation does not work as well as using punctuation for punctuation end

    3. Re:Modula-3 FTW! by Crashmarik · · Score: 4, Interesting

      I used Pascal in some college courses, and felt that my productivity went down by about 50% compared to C, just because of all the extra typing, and the reduced readability: begin using words for punctuation does not work as well as using punctuation for punctuation end

      You felt Pascal was less readable than C ?

    4. Re:Modula-3 FTW! by Anonymous Coward · · Score: 5, Informative

      What can you do in Pascal that you can't do in C++, or Python, or Java?

      I would say that Delphi's advantages over Python and Java are native compilation and its advantage over C++ is the speed of compilation. For fast development of GUI applications (and cross platform these days) Delphi remains one of the best options available.

    5. Re:Modula-3 FTW! by Anonymous Coward · · Score: 5, Insightful

      With enough experience C is more readable. It's a bit like writing "sodium chloride" vs "NaCl". The general population will find the first one more readable because they don't have to know chemical symbols, but if you know chemical symbols, then you find "NaCl" more readable.

    6. Re:Modula-3 FTW! by itzly · · Score: 4, Insightful

      For a beginner, Pascal may seem more readable. For an experienced programmer, C wins. Words like 'begin' and 'end' look too similar to user-defined variables, whereas the curly braces stand out well.

    7. Re:Modula-3 FTW! by Dcnjoe60 · · Score: 5, Insightful

      The problem with Pascal is not that it is bad, but that it provides nothing of value to offset the cost of maintaining a separate toolchain, training programmers, building libraries, etc. What can you do in Pascal that you can't do in C++, or Python, or Java? Why do we need yet another language, that has no particularly useful features?

      This could be said about any programming language. Back in my university days (we still had keypunch machines, then), I had a professor state that you could write just about anything in any language. For instance, you could write a banking app in FORTRAN or a program to calculate the trajectory to the moon in COBOL, but in the end, you should use the best tool suited for the job.

      So, yes, Pascal can't do anything that C++, Python or Java can't do; that's not the point. Is Pascal better suited to some tasks than those languages? That is what the OP is really asking.

    8. Re:Modula-3 FTW! by Grishnakh · · Score: 4, Insightful

      People gave up on Pascal and moved to C++ back then for a reason. Now you're asking people to go back to something which was abandoned in the past, for presumably good reasons. You need to have a **really** good reason for this, instead of just moving to a more modern language.

    9. Re:Modula-3 FTW! by ShanghaiBill · · Score: 4, Insightful

      Is Pascal better suited to some tasks than those languages? That is what the OP is really asking.

      That is also the question I was asking. I believe the answer is "no". Or at least close enough to "no" that it doesn't matter.

      Where I work, we have code in C, C++, Java, Python, Perl, PHP, and JavaScript. All of those language incur a cost, and we would love to eventually pare down the list (Perl is the most likely to go). If you want to write code in yet another language you would need a VERY good justification. I just don't see any place for Pascal in a modern professional programming environment. The theoretical advantages are minimal to nonexistent, and the practical disadvantages, in tools, libraries, maintenance, integration, talent pool, etc. are substantial.

    10. Re:Modula-3 FTW! by Anonymous Coward · · Score: 4, Insightful

      Mmmm. PASCAL was designed by Wirth as an introduction-to-programming instructional language. It was supposed to teach the logic, methodology and 'best practices' of programming as they were defined then.

      Then it got adopted as a production language ... and God knows why ... and went through a few iterations to iron out the bugs and add some features and utilities that a serious production/development language would require (including, most importantly, killing that one shot compiler).

      As a result it has very few strengths compared to purpose designed languages/environments

    11. Re:Modula-3 FTW! by Anonymous Coward · · Score: 5, Funny

      For a beginner, curly braces may seem more readable. For an experienced programmer, Python wins. Curly braces lead to ambiguous interpretation, whereas indentation guarantees a single interpretation and stands out well.

    12. Re:Modula-3 FTW! by Monkey-Man2000 · · Score: 4, Insightful

      Wow, I hope you're not suggesting 22 div 3 vs. 22/3 is more intuitive to a novice for what it does compared to 22/3 and 22/3.0! Both sets look synonymous but if someone told you/me that the first and second of each were different I think the second set is MUCH more clear. **HINT: there's a decimal point in the second set, so it would be natural to assume the return value would have one as well -- no such luck on the first set**

      --
      This post was generated by a Cadre of Uber Monkeys for Monkey-Man2000 (603495).
    13. Re:Modula-3 FTW! by vux984 · · Score: 4, Interesting

      . What can you do in Pascal that you can't do in C++, or Python, or Java?

      So the world only needs 3 languages? Everything from Lua to OjectiveC to Javascript to Haskell... we already have C++, Python, and Java.

      And frankly that's an odd 3 to choose. Why Python? Why not Javascript? Why not Lisp?

      Maybe we just need Pascal, Lisp, and C#.

      "all the extra typing"? I don't even know what to say to that. 99% of programming, is design and debugging. 1% is the actual "typing out the code". If you lost 50% of your time to typing out the code due to typing out begin and and I've got serious concerns about the design.

      and reduced readability

      begin
                Formatting, indentation, and syntax highlighting make using being and end work just fine as block markerers.
      end

      Plus I admit I hate python's semantic white space. At least begin and end don't get mangled simply by copy and pasting a snippet. And since all the semantic information is in the content, the IDE can do the pretty formatting FOR YOU to improve readability.

    14. Re:Modula-3 FTW! by SAN1701 · · Score: 5, Informative

      In my experience (about 20 years professionally working with Delphi, since the first version), the biggest advantage of Object Pascal over C++ is its strong typing discipline. It makes a program more maintainable on the long run, and errors are easier both to avoid and find. Pointer and String handling are also better in Pascal IMHO, and finally compilation time is also much shorter, which is not something to be disregarded when debugging a big project. Against Java or Python, desktop applications are usually more responsive with Object Pascal as it outputs machine code without JIT or GC involved (and usually Delphi will output a single .exe, without the need for any DLLs). Sure enough, you have to remember to destroy your objects, although newest versions of Delphi can use ARC on mobile platforms. My 2c. Sure I've already used all 3 (Python, C++ and Java) when I needed, but I've never felt as productive in any of these as I am in Object Pascal. So maybe the language has it's values.

    15. Re:Modula-3 FTW! by Teancum · · Score: 4, Insightful

      From a maintainability standpoint when you need to have code written by an experienced software developer familiar with Pascal and its various (current) compilers as opposed to an experienced software developer familiar with C++... when you hand those software packages over to another developer to continue development by somebody having to start cold on that software and fix bugs, make extension, or overhaul that code... I dare say that the software written in Object Pascal can be developed sooner than a comparable application in C++. My direct experience has been in about half of the time or less than a comparable C++ program.

      That is my standard for readability. The only reason you might notice some developers who have a hard time with Pascal readability is mainly due to the fact that the developer is simply unfamiliar with Pascal syntax due to a lack of development in that language for a prolonged period of time. Handing Object Pascal code to somebody else already familiar with the language clearly has a huge advantage.

      Just because it is different doesn't mean it is worse. It might mean that you would need to personally take some extra time to learn another programming language. Besides, for a Pascal programmer, curly braces are for comments and stand out very well for that purpose.

    16. Re:Modula-3 FTW! by Motard · · Score: 4, Informative

      Mmmm. PASCAL was designed by Wirth as an introduction-to-programming instructional language. It was supposed to teach the logic, methodology and 'best practices' of programming as they were defined then.

      And it did.

      Then it got adopted as a production language ... and God knows why ...

      Oh, I don't know....maybe it represented the logic, methodology and best practices of programming

      and went through a few iterations to iron out the bugs and add some features and utilities that a serious production/development language would require (including, most importantly, killing that one shot compiler).

      And evolved into seriously great products like Turbo Pascal and Delphi.

      As a result it has very few strengths compared to purpose designed languages/environments

      It remains a great choice precisely because it isn't designed to a particular purpose, but is quite adaptable..

    17. Re:Modula-3 FTW! by lucm · · Score: 4, Funny

      when I try making heads and tails of curly brackets I fall flat on my face.

      Just think of them as melting square brackets.

      --
      lucm, indeed.
  2. Discussion is outdated by Billly+Gates · · Score: 5, Insightful

    In 2015 we choose languages on rich sets of apis. Java for example is almost universally hated for it's syntax yet is insanely popular. Why? 150,000 methods to choose from and frameworks galore.

    No one cares about features as its not 1982 anymore where you write your own libraries. Today you have a task and a tight deadline and there is no time to program. Only time to grab a framework can tinker with it.

    1. Re:Discussion is outdated by William+Baric · · Score: 5, Insightful

      You're right and that's pretty much why computer programs are now so ridiculously buggy and require bug fix releases every two weeks. But then again, as long as customers still buy without complaining, why bother with quality? Worse, a lot of people now think a bug fix release every two weeks is a sign of quality!

    2. Re:Discussion is outdated by Anonymous Coward · · Score: 5, Informative

      That. I couldn't care less if you replaced x = 1 for x := 1 or other simple syntax changes like that. The main thing is, nobody uses Pascal anymore, there's pretty much no useful libraries/frameworks/tooling and whatever else for it, little online resources for it, no jobs that need it and so on. This discussion is outdated by at least a decade. Pascal lost and it won't be back, end of story.

    3. Re:Discussion is outdated by geoskd · · Score: 4, Insightful

      to be FAR more true for C than Pascal.

      On an instruction cycle basis, there are orders of magnitude more C code executing in the world today that any other language. The worlds single most executed pieces of code are all written in C. People should keep that in mind when they make proclamations about C's demise. C will be with us for many hundreds of years for the same reason COBOL wont die, only far more so.

      All android devices run Linux at their core which is C. Further, a large swath of embedded devices that don't use android are written in C anyway. These language popularity counting systems always neglect the jobs that require C, but don't explicitly state that. Jobs like hardware designers that need to provide hardware access code. Virtually nobody writes embedded code in Java, Perl, Pascal, COBOL, or any of hundreds of other languages. The few that have made some inroads into embedded systems are rare, and have not made much progress. If you want to understand the Internet of things, you'll only ever get halfway there if you don't know C.

      --
      I wish I had a good sig, but all the good ones are copyrighted
  3. Pascal is straight forward by caffiend666 · · Score: 4, Interesting

    Pascal is straight forward, something missing from most modern language which hide substantial implicit variations in how the language behaves by handing behind syntax like Perl or impossibly verbose statements like VB. I worked with Delphi professionally and still think fondly of it. Is a third-generation language, so is closer to system behavior, but is also a great teaching language which is sorely lacking from modern programming.

    --
    Here's to losing my Karma Bonus again....
  4. One important use left for Pascal by jolyonr · · Score: 5, Insightful

    However...

    When the only jobs for Pascal programmers are teaching other people how to program in Pascal, you know there's a problem.

    --


    Please read my Canon EOS tech blog at http://www.everyothershot.com
    1. Re:One important use left for Pascal by angel'o'sphere · · Score: 4, Insightful

      Pascal wins over C hands down as soon as you are doing something that is 'business' and not bit shuffeling.

      type
            MyStufd is RECORD ....
              END
              MyData is file of MyStuff;
      var infile, outfile : MyData;
                  data : MyStuff;
      begin
            infile := openForReading("filename");
            outfile := openForWriting("anotherfile");
            { read and pick the result to write to outfile }
            read(data, infile);
            if 'data is good enough' then
                    write(data, outfile);
      end.

      BTW, not sure about keywords, I think 'is' is Ada and not Pascal, but you get the idea.

      There are plenty of other examples, like packed arrays of records, sets, the clear hierarchy of consts, types and variables, var parameters to procedures etc. etc. The definition of units and the usage of them comes to mind. Yes, you can do all that in C, but you use ideoms and need much more knowledge what you are doing. In Pascal it is super simple to write a 'compilation unit' that is either a program or a (part of a ) library, in C it is not, you ned to know when and why to use extern, static etc.

      If you believe C is in any way better than Pascal you can not program ... definitely not in Pascal and very likely not in C either.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  5. Early fragmentation by itsdapead · · Score: 4, Interesting

    One early problem with Pascal was fragmentation: while there were various decent, proprietary, dialects that let you actually write code that did stuff, *standard* Pascal was as much use as a chocolate teapot. Standard Pascal had lousy I/o and minimal libraries. the standard didn't even specify how to open a file, whereas C always had a decent subset of the Unix API as part of the de-facto K&R standard.

    Had Pascal come a few years later when the IBM PC had crushed all before it, then something like Turbo Pascal might have been far more successful. However, back when there was more than one type of PC to worry about, C's huge standard library, and it's preprocessor for fixing minor dialect issues made it unbeatable for writing portable code.

    --
    In a survey of 100 programmers, 111111 thought that duck-typing was a good idea.
  6. Ahh... Pascal. by fahrbot-bot · · Score: 4, Interesting

    My university actually taught/used Pascal in the classroom in the early/mid 1980s and I graded programs written in it. Kernighan's criticisms of Pascal on BSD are spot on - I know, I tried using it for a (more) serious project. The semester project for my Operating Systems class was to simulate an interactive operating system - in Pascal.

    The system used for the class was the University's IBM 4381 mainframe running MUSIC ("McGill University System for Interactive Computing") and the version of Pascal had *lots* of libraries and features.

    I was a undergraduate research assistant (working on an AI project, funded by NASA, in LISP and Prolog) and had an account on the VAX-785 running 4.3BSD and wanted to use *that* (on my schedule) instead of standing in line to use the IBM. My instructor said "sure", but I'd have to port the support libraries he wrote for the assignment. Unfortunately, the version of Pascal on BSD was just the basic language - as specified in the Language Definition book by Jensen and Wirth. Porting the code from the "richer" version of Pascal on the IBM/MUSIC to the "basic" version on VAX/BSD was simply not possible.

    So, I asked my instructor if I could, instead, do the semester project in C. He said "sure", but, again, I'd have to port his libraries from Pascal to C. Now... I didn't know C at the time, but porting his code to it and doing my semester project in it was a great introduction - and I passed the class. All-in-all, this experience help me out immensely with my CS career as I do a LOT of cross-platform work in many programming languages - though not Pascal :-)

    --
    It must have been something you assimilated. . . .
  7. Hints from an over-the-hill programmer by jgotts · · Score: 5, Insightful

    It doesn't matter what programming language you use. Go ahead and use Pascal if it's the best choice for the job.

    To be a great programmer, you need to write code that reads like English. We have a framework inside of brains called English speech, reading, and writing. If you're a French speaker, or speak another European language, your framework isn't much different. A great French programmer or a great German programmer will program similarly to a great English programmer. Everybody's seen expressive code. You can look at the code and understand what it does almost instantly. Comments, variable names, abstraction, everything that makes a great programmer, all of these things come into play. Conversely, everybody's seen shitty code that takes several days to understand. I don't care what language it is. You're a horrible programmer if you write code like this. Nobody cares how clever you are, or how you've mastered the specific grammar of a certain language. You will eventually move on and someone else will have to modify your code. The best place for clever code is in the trash bin.

    To be a great programmer, you need to be able to plan out what you're going to do in advance. Everybody's worked with hacked together shit, and has had to maintain it. Hacked together shit wastes programmers' time. Spend a few days doing absolutely no "programming" whatsoever. Instead draw some flowcharts, try out a rough prototype, brush up on some theory, write up an estimate, and have someone else review everything.

    Learn to be realistic about how long your work will take. I know, genius programmer, you can get everything done in about a day. Be true to yourself and don't try to impress anybody with your speed coding abilities. Take your time, and get it done right. Spend an entire day or several days testing. There's nothing better than a launch that is bug free.

    Be prepared to explain your code on a whiteboard to your own mother. If you can't explain what you're doing to your own mother, you don't understand the problem well enough, and chances are you're overlooking something. Your boss will have somewhat more expertise than your mother, but if you can justify what you're doing to her then you're probably on the right track.

    Don't be that guy who jumps on every programming fad. If something been around for 20 years, it's probably worth considering. If something's been around for 3 years, perhaps the fad will die out and your company will get stuck maintaining an obsolete framework. Been there, done that.

    I don't care if you went to MIT or only high school, we're all equal. You can't go away and work in your little PhD way, emerging a month later with a piece of code that everyone despises. Programming is a team effort. If you think that nobody else can write a piece of code except a PhD, then guess what? Your software is likely to fail, because nobody will be able to maintain it, especially when that PhD leaves to go be a professor at Stanford.

    I've seen these mistakes repeated over and over for all 25+ years I've been a programmer.

  8. This. SO MUCH This. by brunes69 · · Score: 5, Insightful

    I often feel like everyone on Slashdot is a mix of two people

    - Old 50+ year olds used to the good 'ol days when you would write your own stack from scratch whenever writing an application

    - 20 year olds fresh out of (or still in) college who yell "squirrel!" at everything new and shiny

    The truth is, that 75% - 90% of the business applications that make the world go 'round, and make nearly every startup today go 'round, are based on Java or some complimentary technology like Node.js with Java bindings. The reason for this is simple: The Apache foundation. There are SO MANY amazing enterprise-class Java libraries available via the Apache project that there is little to no reason to ever write your own. The mantra where I work, and it should be where EVERYONE works, is before you write any plumbing code at all, check Apache first. People who roll their own plumbing code INVARIABLY end up with subtle errors they did not think of or subtle problems that will manifest themselves in 2 or 3 year when they try to scale.. and all these problems were likely already figure out long ago.

    When building a woodsheed, do you cut down the trees, mill the lumber, and forge the nails? Of course not, you take advantage of modern economies of scale so you can focus on the REAL building project, not the building blocks. The same is true for any halfway competent software developer.. The days of people writing their own libraries for DB MVC, for configuration management, for network access, for parsing libraries, for thread pools.. these days are gone, and thank god. The less you have to worry about the low-level plumbing, the more you can focus on the real business problem. And furthermore, the more people that make use of a low level plumbing libary, the better and more secure and stable it becomes, for everyone.

    1. Re:This. SO MUCH This. by greg1104 · · Score: 4, Interesting

      40 is old for a software developer. Someone who is 40 today entered college just as web browsers were being invented. You could not just connect the dots on library calls to put together an application then. Now you can.

      I have a strong sense of wanting to know how things work that comes from having built a lot of software in the 80's and 90's, when you had to know the internals to make progress. That is downright counterproductive in web development now. By the time you learn enough to understand how a library works, the developer who just learned enough to use it already shipped their code. That's the sort of disconnect between age ranges at work now.

    2. Re:This. SO MUCH This. by Motard · · Score: 5, Informative

      I'm an old 50+ developer who has had to reinvent myself several times throughout my career. And while a lot of really good new developments for, um, developers have come our way, a lot of valuable things from the past have been lost. For instance, I continually cringe when needing to write SQL code within some other language. There was a time when database access was actually a fundamental part of the language. 4th generation languages, for instance, are largely forgotten - but they really were useful. Same goes for ISAM data access. It is insanely efficient compared to what we typically do today.

      Yes, SQL is great for some tasks, but most of that functionality is merely overhead for the sorts of common tasks and application has to perform on a daily basis. If I have the primary key to a table, it's wasteful to generate a query when I can just say 'get me this'.

      This is where NoSQL proponents might pipe in with new solutions. But those aren't usually good solutions for general purposes. I've seen too many over-normalized databases over the years, and talked to their proponents. They propagate an ideology of theory over practical considerations.

      The thing is though, Pascal excels (or can excel) at all of these things. I'm really referring to Delphi here. The component library available is huge and varied, By your choice it is 100% open source, or completely proprietary, or a mix. In fact, the only major problem I've ever had with Delphi is rebuilding your development environment on a new machine, because you've installed so many tools over the years.

      With Delphi, I could drop a terminal emulator on a form and have it working in five minutes. Or I could resort to in-line assembly language if needed. I could, off the top of my head, develop web apps in at least three totally different ways.

      I saw a comment further up the pages that asked why we need Pascal when we have C++, Java and Python. Well, seeing as how Pascal predated all of these, and will do everything those do, why do we need the newer languages?

      I really encourage younger developers to give it chance. You can install and use Lazarus for free. I feel that Delphi is better polished and reliable, But if you're really an open source advocate, then contribute to Lazarus and/or Free Pascal.

      Having had some experience with most of these other technologies, I think you might be surprised at how much you're missing.

  9. Occupied a very important niche ... strong typing by NothingWasAvailable · · Score: 4, Interesting

    I worked on an industrial project that consisted of a couple of million (with an "M") lines of Pascal. We used IBM's Pascal/VS dialect. Pascal/VS had extensions that made it very, very close to Modula-2. We used Pascal because it was portable (across IBM platforms) and strongly-typed. At the time, it was the only strongly-typed language available to us. Our error rate (bugs reported by customers) was incredibly low, because it was really hard to make many of the screw-ups that were then common in PL/1, Fortran, and c. We ended up with a system that ran across IBM's product line (mainframes, workstations, PC's).

    As Pascal aged (we could see that support would be ending), we moved to C++ by converting the entire code base into a subset of C++ (using a software package we purchased and thousands of lines of AWK and sed). We used C++ as a "strongly typed subset" of "c" for about 10 years, before we started converting to objects and methods.

    That project started in the 80's and is only now (almost 30 years later) being rolled up and decommissioned. The original architecture was very structured, streamlined, and simple; with an incredible amount of effort going into defining data structures (as befit the restrictions of Pascal, like no dynamic arrays). It held up very, very well. Still blows the doors off its competition in performance, but the company is getting out of development and support, and needs something it can buy (even if it's slower and has less function.)

  10. Pascal vs Wirth's newer languages by __aahgmr7717 · · Score: 4, Informative

    I am amazed that almost no one seems to be aware that Dr Wirth is 3 generations of software beyond his original Pascal.
    He also created Modula, then Oberon and is now working on Project Oberon using Oberon-7.
    The spin off company Oberon Microsystems created the framework BlackBox and a superset of Oberon called Component Pascal.
    Component Pascal is now maintained by the user community and is open source.
    http://blackboxframework.org/i...

    I don't especially like Pascal but I love Component Pascal!