‹ 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. ape4 · · focus · HN ↗
        If I remember right, it was memory safe - something C/C++ has yet to achieve.
        1. 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 ↗
            > It just made any dynamic structures so painful that few programmers used them

            What's an example of the pain?

            1. cyberax · · focus · HN ↗
              Awkward syntax for pointer access, for one thing.
              1. cisc · · focus · HN ↗
                What's awkward about the syntax? It'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. 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?
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.