‹ BackHN Continuity

Thread

Modern Object Pascal Introduction for Programmers

204 points · 90 comments · birdculture

  1. baranul · · focus · HN ↗
    It's amazing how underestimated the Object Pascal language is. Certain people or rivals want to write it off or declare it's "dead", yet the language (including various dialects) are still going strong.
    1. pjmlp · · focus · HN ↗
      Yeah, it was pity that Borland lost its way, and Apple decided to refocus from Object Pascal into C++.

      Otherwise it would still be a big contender.

      Everything that Zig offers over C as selling point was already there in Object Pascal.

      1. applfanboysbgon · · focus · HN ↗
        Comptime? Vastly superior toolchain? Trivial C interop? Sub-second incremental compilation in large projects? I'm not familiar with Object Pascal at all, so do correct me if I'm wrong, but I'd really be surprised if it has much of Zig's standout features.
        1. pjmlp · · focus · HN ↗
          Comptime is the only thing going for it.

          Object Pascal compilers were already super fast in MS-DOS hardware!

        2. lelanthran · · focus · HN ↗
          > Comptime? Vastly superior toolchain? Trivial C interop? Sub-second incremental compilation in large projects?

          No comptime, but everything else, sure, Turbo Pascal (and then Delphi) had.

          Maybe it'll blow your mind (not sure if you find this impressive or not), but Turbo Pascal had sub-second compilation per module on large modules back on my 486 with 4MB of RAM.

          Sure, Zig has more features than Pascal, but not the ones you listed (except, of course, for comptime).

          1. andsoitis · · focus · HN ↗
            > (and then Delphi) had.

            And still does. You can get the latest version of Delphi (including a free version for non-commercial use) here: <a href="https:&#x2F;&#x2F;www.embarcadero.com&#x2F;products&#x2F;delphi" rel="nofollow">https:&#x2F;&#x2F;www.embarcadero.com&#x2F;products&#x2F;delphi

            It rocks.

            You&#x27;re also not limited to Delphi. You can use Oxygene <a href="https:&#x2F;&#x2F;www.remobjects.com&#x2F;elements&#x2F;oxygene&#x2F;language" rel="nofollow">https:&#x2F;&#x2F;www.remobjects.com&#x2F;elements&#x2F;oxygene&#x2F;language

            1. lelanthran · · focus · HN ↗
              &gt; You&#x27;re also not limited to Delphi. You can use Oxygene <a href="https:&#x2F;&#x2F;www.remobjects.com&#x2F;elements&#x2F;oxygene&#x2F;language" rel="nofollow">https:&#x2F;&#x2F;www.remobjects.com&#x2F;elements&#x2F;oxygene&#x2F;language

              If you&#x27;re not in the mood to rent your compiler, you can also try Lazarus.

              1. andsoitis · · focus · HN ↗
                Sure. The rent does give you polish, however.

                Also, for non-commercial use, Delphi is free.

        3. mickeyp · · focus · HN ↗
          Delphi would compile &amp; link 2 MLOC of code on a crappy work laptop in 30 seconds to a minute. Incremental compiles were instant. So fast most developers never bothered learning the &quot;go to next error&quot; hotkey and just spammed F9 (compile &amp; run) whenever they fixed a syntax error. It was that fast.

          Trivial C interop - yes. Both pascal and cdecl style calling conventions.

          Toolchain? Back then - yes. Today? Probably not; depends what you mean by it. It had perfect COM interop which mattered back then, and you could trivially link stuff if you wanted to. And people did.

          1. tliltocatl · · focus · HN ↗
            Comptime here means not &quot;compilation time&quot;, but rather ability to run some your code during compilation (i. e. compile-time metaprogramming). Pascal didn&#x27;t had this.
            1. applfanboysbgon · · focus · HN ↗
              They probably know that. I specifically mentioned actual compilation time as another one of the things that&#x27;s great about Zig, so it is relevant to mention. Certainly the language sounds nice from what I&#x27;m hearing. These days most languages are deeply neglecting compilation time as a feature (interpreted languages aside), so Zig is a breath of fresh air for me in that regard.
              1. klipt · · focus · HN ↗
                Golang is also designed to compile very fast.
                1. applfanboysbgon · · focus · HN ↗
                  Yes, I do appreciate Go&#x27;s existence as well.
                  1. jan_m_savage · · focus · HN ↗
                    Go directly is inspired by Modula-3 and Oberon-2, both are descendants from Pascal family. One of the Go&#x27;s fathers was Wirth&#x27;s students IIRC.
                    1. pjmlp · · focus · HN ↗
                      Oberon-2 surely, there are zero Modula-3 influences in Go.

                      Also Wirth had nothing to do with Modula-3, that was all DEC &#x2F; Olivetti SRC work, done by ex-Xerox people with experience on Cedar and Modula-2+.

                      1. jan_m_savage · · focus · HN ↗
                        &quot;Go is mostly in the C family (basic syntax), with significant input from the Pascal&#x2F;Modula&#x2F;Oberon family&quot;

                        source: <a href="https:&#x2F;&#x2F;go.dev&#x2F;doc&#x2F;faq" rel="nofollow">https:&#x2F;&#x2F;go.dev&#x2F;doc&#x2F;faq

                        Without Pascal there would be no Modula.

                        1. pjmlp · · focus · HN ↗
                          Modula-3 where is it?

                          I do agree with Modula, which isn&#x27;t the same as Modula-3.

                2. baranul · · focus · HN ↗
                  This includes some languages inspired by Golang, that have &quot;inherited&quot; Pascal influences, such as Vlang. There&#x27;s also a focus on fast compilation and being useful for prototyping.
          2. mldbk · · focus · HN ↗
            Oh my gosh! Core memories unlocked:

            &gt; most developers never bothered learning the &quot;go to next error&quot; hotkey and just spammed F9 (compile &amp; run) whenever they fixed a syntax error

            We didn&#x27;t know we were privileged. I thought it was normal thing to have.

          3. pjmlp · · focus · HN ↗
            COM interop matters even more today, as COM (and WinRT as its evolution) has become the main mechanism to deliver new APIs since Windows Vista.

            Ironically it is still easier in Delphi than the frameworks Microsoft keeps pouring out for .NET and C++.

            I keep joking they should afford some Embarcadero licenses to learn how to actually do it.

        4. sakesun · · focus · HN ↗
          Object Pascal has more runtime reflection features which were added to facilitate visual programming paradigm. Do you know what can be faster than sub-second incremental compilation ? Run-time&#x2F;Design-time manipulation !
      2. ape4 · · focus · HN ↗
        If I remember right, it was memory safe - something C&#x2F;C++ has yet to achieve.
        1. pjmlp · · focus · HN ↗
          Even PL&#x2F;I, JOVIAL, and NEWP on the decade predating C had it.
        2. cyberax · · focus · HN ↗
          It was not. It just made any dynamic structures so painful that few programmers used them.

          But it _did_ have range checks for array access.

          1. cisc · · focus · HN ↗
            &gt; It just made any dynamic structures so painful that few programmers used them

            What&#x27;s an example of the pain?

            1. cyberax · · focus · HN ↗
              Awkward syntax for pointer access, for one thing.
              1. cisc · · focus · HN ↗
                What&#x27;s awkward about the syntax? It&#x27;s straightforward:

                <a href="https:&#x2F;&#x2F;docwiki.embarcadero.com&#x2F;RADStudio&#x2F;Florence&#x2F;en&#x2F;Pointers_and_Pointer_Types_(Delphi)#Overview_of_pointers" rel="nofollow">https:&#x2F;&#x2F;docwiki.embarcadero.com&#x2F;RADStudio&#x2F;Florence&#x2F;en&#x2F;Pointe...

                <a href="https:&#x2F;&#x2F;castle-engine.io&#x2F;modern_pascal#_pointers" rel="nofollow">https:&#x2F;&#x2F;castle-engine.io&#x2F;modern_pascal#_pointers

                1. cyberax · · focus · HN ↗
                  You need to dereference pointer to access the structure fields, for example.
                  1. cisc · · focus · HN ↗
                    Nope, you don&#x27;t need to. For example, all class references are pointers and they don&#x27;t need to be dereferenced manually.

                    Object Pascal&#x27;s pointer syntax is detailed in the links I gave you.

                    1. [deleted] · · focus · HN ↗

                      [deleted]

                    2. cyberax · · focus · HN ↗
                      This is the modern Object Pascal. Here&#x27;s the Turbo Pascal syntax: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Object_Pascal#Heap_based_allocation" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Object_Pascal#Heap_based_alloc... - if we&#x27;re comparing something that was around the same time as C++.
                      1. pjmlp · · focus · HN ↗
                        So your point is having to write ptr^.val instead of either (*ptr).val, or ptr-&gt;val?
      3. sehugg · · focus · HN ↗
        I recall the turning point was when id used the Watcom compiler for DOOM. Watcom had the 32-bit flat model DOS extender and were starting to add the difficult optimizations. Turbo&#x2F;Borland Pascal was built for compile and link speed, not even getting a real -O option until Delphi (except for turning off range and stack checking)
        1. pjmlp · · focus · HN ↗
          Turbo Pascal 7 had them as well.
      4. LoganDark · · focus · HN ↗
        &gt; Apple decided to refocus from Object Pascal into C++

        IIRC Apple went and made Objective-C(&#x2F;C++) and then eventually Swift. Not sure if they actually embraced C++ all that much - did they really?

        1. pjmlp · · focus · HN ↗
          Completely off the charts.

          I am talking about Apple after Jobs was kicked out.

          You missed the part where NeXT licensed Objective-C from Stepstone, Apple bought NeXT as last survival action before bankruptcy, and OS X sprung out of NeXTSTEP.

          1. LoganDark · · focus · HN ↗
            Thanks!
    2. shevy-java · · focus · HN ↗
      IMO it is not entirely dead, but not really &quot;alive&quot; either. TIOBE even has Object Pascal mentioned right now in TOP 20. Now, TIOBE has tons of issues, but it also means that there exists some tangible interest.

      Still, I don&#x27;t feel many people want to use Object Pascal these days. If you have the choice between Python and Object Pascal, most people will undoubtedly use Python. It&#x27;s just how it is right now, and I also don&#x27;t see how that can change in favour of Object Pascal. Programming languages nowadays have so much more competition, and people are less tolerant of flaws. Strangely enough, people barely seem to work on these flaws; this is one of my pet peeve with ruby, the documentation should be much better but it is not. I no longer find that acceptable in 2026, with AI spam slop lowering the quality and google search being terrible and almost totally useless nowadays. You&#x27;d assume that a counter-move to this slop-degradation would be to massively improve documentation, but you still find core projects in ruby or at the least important add-ons, to have low-quality documentation. And barely anybody wants to improve on that either.

      1. pjmlp · · focus · HN ↗
        Indeed the &quot;why bother with performance when others write code in C for us&quot; mindset.
    3. maomao5 · · focus · HN ↗

      [dead]

      1. Narishma · · focus · HN ↗
        For me it&#x27;s less the verbose syntax but more the weirdness and inconsistency of it. Like making a distinction between a procedure and a function, or returning data from a function by assigning it to a magical variable. It feels like a cobbled-together language rather than a properly designed one.
        1. MaxBarraclough · · focus · HN ↗
          I wasn&#x27;t able to find a definitive account of why they&#x27;re separated in Ada, but I believe the idea is this: functions are for where code behaves in a roughly functionally pure way and yields a value that should not be discarded by the caller, whereas procs are for functionality with &#x27;deep&#x27; side-effects.

          The SPARK subset of Ada comes pretty close to enforcing purity of Ada functions, although it still permits them to read globals. [0]

          It&#x27;s not just an oversight. The core of the Ada language was designed deliberately. [1]

          [0] <a href="https:&#x2F;&#x2F;learn.adacore.com&#x2F;courses&#x2F;intro-to-spark&#x2F;chapters&#x2F;01_Overview.html#no-side-effects-in-expressions" rel="nofollow">https:&#x2F;&#x2F;learn.adacore.com&#x2F;courses&#x2F;intro-to-spark&#x2F;chapters&#x2F;01...

          [1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Ada_(programming_language)#History" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Ada_(programming_language)#His...

      2. kjs3 · · focus · HN ↗
        People hate the verbose syntax

        People hate verbose syntax until it&#x27;s about a language they like. Then suddenly &quot;the IDE takes care of that so I don&#x27;t care&quot; or some such. With Ada in particular, if you gave up safer programming for 40 years because &quot;ew nasty I have to type begin...end...&quot; then I don&#x27;t want to hear about your pet safe language.

      3. pjmlp · · focus · HN ↗
        The same people that now program in English, writing Markdown file after Markdown file?
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.