Hacker News new | ask | show | jobs
by networked 4843 days ago
Cool demo. What caught my attention was this line in the description:

>The terrain is procedural, generated offline by a Delphi program (Delphi is a modern version of Pascal).

Nowadays I very rarely see new projects use Object Pascal or Delphi. This is somewhat disappointing since I think it really is a fine language that could be a viable alternative to C++ and Java due to its combination of high performance and clean syntax [1]. But then again, C# is very popular and it is pretty much the new Delphi.

Does anyone here use Object Pascal in their current projects?

[1] At least in theory. I'm not necessarily talking about the particulars of the Borland/CodeGear/Embarcadero implementation since Anders Hejlsberg left for Microsoft, which were not always perfect.

8 comments

Thank you and I completely agree! I hold VCL especially in very high regard. As for Delphi, I think it doesn't get nearly the mindshare it deserves. As a side note, the CAD software we're making in my company is entirely written in Delphi (with some bits in assembly):

http://www.anadelta.com/index-en.php?s=exported

You may recognize the sky :)

I used Delphi for a 16-bit Windows game ages ago. However I skipped all of the UI builder stuff (which is the primary reason you'd want to use it in the first place) and coded directly against the Windows API, with the help of some inline asm.

So why not just use C? There were good reasons. In 1992 C/C++ compilers on the PC were slow -- pre-compiled headers were still mysterious -- and Delphi's handwritten compiler and integrated linker made the edit/compile/run cycle very very fast. It made small, fast, completely stand-alone (no MSVCRT.DLL or anything) binaries -- a feature which still supposedly makes it popular with malware authors.

The UI builder was excellent and perfect for knocking off one-off tools like the terrain generator described above. As long as you stuck to Windows, of course.

I don't know if I would necessarily go back though. While I sometimes miss some of Pascal's features like ranged types and sets (and bounds checking on arrays) the performance advantages of the specific Borland implementation have become less important, and there are other contenders that cover a bigger problem space than the delta between Pascal and C.

BTW, here's where Google Trends says Delphi is popular nowadays: http://www.google.com/trends/explore#q=delphi&cmpt=q

I think there's a lot of low profile software out there written in Delphi which doesn't get mentioned because it's not a reason to buy, and may be a reason not to buy. There's a nice windows installer tool I occasionally use written in Delphi.
I was very impressed when I found out that Pascal supports subrange types (that is types with custom, user-defined ranges). I had only seen it in VHDL / Ada before, where I found it to be very useful.
Yes, that has been a feature of the original Pascal design, since the 1970s. Very useful for catching out of range errors.
After using Delphi professionally for some years, I pretty much hated it. Some of my least favorite features are automatic and locale-dependent string/WideString conversions, and that there are multiple memory models: interfaces (IUnknown) uses reference counting, TComponent is owner-based, and lots of other classes require manual memory management.

On the other hand, the object system has some nice features. I miss AfterConstruction and BeforeDestruction in other languages, and I like virtual constructors.

I did a course on object pascal in 2002 (just before that college, like many others, switched to java). A few months ago, I had a look at Ada, and found it pleasantly similar to object pascal. If you've played with pascal, but not with Ada, I recommend having a look :-) Eg:

http://blogs.fsfe.org/thomaslocke/2013/02/10/using-the-ada-w...

I found some pleasant similarities between Pascal and Go (Golang)
What are they, aside from just := and the lack of brackets?
Actually Go's use of := is almost anti-pascal: it means something rather different, but similar enough to be confusing, and so is likely to confuse anybody who's used to the vastly more common meaning of := in Algol-family languages (Pascal, Ada, etc).

... and then there's Go's screwed up version of Pascal-style declaration syntax...

[a link to my earlier rant on this subject: http://news.ycombinator.com/item?id=4520104 (TL;DR: Go: "var foo, bar int"; Pascal: "var foo, bar : int"; the colon vastly improves readability, and has no real drawback)]

> the colon vastly improves readability

We have gofmt for that :)

> > the colon vastly improves readability

> We have gofmt for that :)

Er, what? gofmt doesn't improve the readability of declarations at all... [there's really not much it can do]

It spaces them evenly if you have multiple subsequent lines of them. Readable enough:

    var (
        i, j        int
        foobarStuff string
        bebop       bool
    )
What's not readable?
Go's declaration syntax (http://golang.org/doc/articles/gos_declaration_syntax.html) and package system are inspired by the Pascal family, according to the FAQ (http://golang.org/doc/faq#ancestors).
I used to write Pascal a decade ago. Does it still have endless begin-end statements?
Does C++ still have endless opening and closing braces? :)