Hacker News new | past | comments | ask | show | jobs | submit login

Lazarus/FPC checks so many nice boxes:

[x] Statically compiled

[x] Native UI on Linux/Mac/Win

[x] Typically compiled without code changes on Linux/Mac/Win

[x] Small binaries

[x] No GC

[x] Readable, somewhat python-like syntax

[x] Still, doesn't rely on indentation for nested blocks

[ ] (Fill in)




As soon as you need 3rd-party libraries "statically compiled" is no longer the case. Or at least it's not easy, depend on platform and still bring a lot of mess.

Though in the right hands Lazarus is a great tool since relatively complex project could be completed just by one developer. E.g here is our game engine map editor:

https://github.com/vcmi/vcmi_editor

Another thing to note is that FPC provide good performance and even used for game development and memory footprint is small. There is RTS on Steam called Cossacks 3 and it's fully in Pascal (though no idea if they using FPC outside of Linux):

http://store.steampowered.com/app/333420/Cossacks_3/

PS: Another example would be open source Hedgewars of course.


> [x] Readable, somewhat python-like syntax

I have a rather different opinion on OP that it has a needlessly verbose syntax.

Pythonic it is definitely not. Even C# (which is another creation of Anders Hejlsberg, after MS poached him from Borland) has a better, readable and concise syntax.

I used to be a Delphi evangelist in it's glory days. Now I bristle when I read Pascal source code, there's so much unnecessary visual noise. Of course if your brain is habituated enough to parse Pascal code, eventually you will tend to filter out the begin..end's.

Pascal syntax belongs to C family of language.

As regards to Python-like syntax, I think you are referring to the Nim language, whose syntax happens to be similar to that of Pascal.


> Pascal syntax belongs to C family of language.

It can't possibly, seeing how it predates C.

There are specific differences that set them apart, too. For example, the fact that Pascal has statement separators rather than statement terminators (and using a separator in a terminal position is usually an error, e.g. before "else").

Pascal rather belongs to the Algol family of languages, together with C. Algol-60 is where "begin" and "end" come from.


Ex-Delphi developer (10 years) - still do some maintenance...

The verbosity is an indicator that it does not require a huge cliff of learning to understand the syntax. (It also means the compiler can absolutely fly, which Delphi did.)

I like the conciseness of later language structures, but they all need to be learnt in order to read or write in them.

The only solution to the verbosity of Delphi was to increase your typing speed or use an IDE add-in that provided shortcuts :)

So I suppose my argument is that the syntax is not needlessly verbose. The verbosity helped the speed of compilation by the simplicity of its grammar, and the learnability of the language is quite speedy as a result of fewer grammatical options.


My feeling as well. In my heart I am really happy that Lazarus (and Harbour, the Clipper-compatible compiler) exist, but being rational the days of desktop applications are over.

Python is being run on microcontrollers these days; I actually wrestle with the non-adoption of Python (or Ruby, or Javascript, or Tcl) as 1st-class citizen language for desktop and mobile; it does not make sense for me. Certainly writing desktop/web apps in C++ or Pascal make even less sense.

Perhaps I am forgetting the big number of fellow developers that work on ERP systems and outdated software, for them it is a blessing to have free tools, while in the 90s such a tool could cost $3k.


> Python is being run on microcontrollers these days;

So does Pascal and its descendent Oberon, including FPGAs.

https://www.mikroe.com/mikropascal/

http://www.astrobe.com/default.htm

Natively compiled to machine code, safe, without any help of C.


> My feeling as well. In my heart I am really happy that Lazarus (and Harbour, the Clipper-compatible compiler) exist, but being rational the days of desktop applications are over.

Oh boy, I hadn't heard about Harbour until now; earlier today I was looking at the Wikipedia page for id Tech 5, and it says it uses Clipper so I was really scratching my head wondering how they pulled that off and why. Now I know, thanks for mentioning it. :- )


Just you wait edge computing will move a lot of power to the client... it's coming, especially for AI, cars and any intelligent device.


Wait. Why would a 3D game use Clipper? What for?


That's what I was wondering, I'm thinking of tracking down whoever added that to the Wikipedia page, because I don't know how they found out.


I very strongly suspect that some confused person (or algorithm?) saw that that the level design tool Radiant has a "clipper" and ran with it.


https://en.wikipedia.org/w/index.php?title=Id_Tech_5&diff=pr...

Hard to say, bots usually have usernames, so probably a person.

https://en.wikipedia.org/wiki/Special:Contributions/99.100.1...

They also seem to have added a similar section to the id Tech 6 article, it's possible they're just an insider.

https://en.wikipedia.org/w/index.php?title=2015&diff=prev&ol...

But looking at other edits from this address it sees like they might just be a vandal; or at least somebody who is very confused about how Wikipedia works.


If someone is working on ERP systems then I don't think the cost is going to be that significant to them.


> Even C# has a better, readable and concise syntax

C# has amazingly easy-to-read syntax, but maybe I'm biased because I'm most comfortable with C-like syntaxes.


One of the main points that makes me happy about Pascal syntax compared to some C-family langs like Java is that types are placed AFTER the variable names, making it much easier to scan the left border of the editor for meaningful info.

Happy that recent languages like Go and Kotlin have learned the lesson and are going the Pascal way again.


> there's so much unnecessary visual noise

FWIW, I took over maintenance of an in-house application written in Delpi/ObjectPascal, with practically no prior experience with Pascal (but one fun weekend looking at Ada), and I had almost no problems reading the code that were caused by Pascal's syntax. It might be because the guy initially wrote the application did a good job, but I found the code very easy to read.


[x] Easy string handling (compared to C)

I like how you say python-like syntax... as so many borrow from Pascal


I've created small projects in Lazarus and you are right in all points except in the small binary part, also I would add that it comes with db drivers for Postgrees, MySQL and Firebird SQL out of the box.


If you compare to the "modern" way of building cross-platform apps: Electron ... with its 100s of MBs, I'm definitely regarding Lazarus binaries as small :)


Electron is degenerate, not "modern". XUL was modern.


Depends on what you define as small but if you remove the GDB debugging information you can trim down your binaries by a huge amount. My last project was 3.4MB.


Back in the day I used to run the exe through and get them even smaller: https://upx.github.io/


UPX is misleading though since it needs more memory than the EXE itself.


No GC is actually an advantage? The world really changed, there are people rejoicing for procedural languages, while we have so many excellent OO and FP alternatives, and they are actually happy to shoot their own foot with manual memory management. I'm not really sure that the change has been for the better.


Lazarus is Object Orientated. Delphi definitely offers garbage collection in newer versions, not sure about Lazarus.


No. Delphi offers reference counting, but only on interface variables. It's a huge difference really, because if your last interface variable that points to an object goes out of scope, the object is freed from memory. Even if you have raw class pointers to it.

Example:

    IMyInterface = interface
        procedure Foo;
    end;

    TMyClass = class(TInterfacedObject, IMyInterface)
        procedure Foo;
    end;

    procedure TMyClass.Foo;
    begin
        WriteLn('Foo');
    end;

    procedure DoTheFoo(AObj: IMyInterface);
    begin
        AObj.Foo;
    end;

    procedure SomeMethod;
    var
        LObj: TMyClass;
    begin
        LObj := TMyClass.Create;
        DoTheFoo(LObj);
        LObj.Foo; // <-- Will cast nil pointer exception,
                  // as object was freed when AObj in DoTheFoo went
                  // out of scope
    end;
I work with Delphi in my day job.


For those lacking CS background, reference counting is an GC algorithm.

The 5th chapter from "The Garbage Collection Handbook", http://gchandbook.org/, one of the most renowned books in the field, there are of course other equally renowned sources I can refer to.


Formality aside, it's about deterministic GC vs nondeterministic GC.


Reference counting isn't deterministic in the presence of large complex data structures.

You will know when memory gets deleted, but not how long it will take, nor how much stack space the destructors will require to run.

Enjoy Herb Sutter's "Leak-Freedom in C++... By Default." at CppCon 2016, where he explains how those issues affect C++ and goes on to implement a tracing GC.

https://www.youtube.com/watch?v=JfmTagWcqoE


You would never code the SomeMethod like that, you would use this instead:

    var
        LObj: IMyInterface;
    begin
        LObj := TMyClass.Create;
        DoTheFoo(LObj);
        LObj.Foo;
    end;


Oh, in that case that's no better than C++'s shared_ptr.

I remember Delphi being fun back in the day and it still compiles way faster than C++, but C++ is evolving and maybe with modules even the compilation speed gap will disappear...


I actually feel that shared_ptr is a better fix, because that makes the memory handling consistently opt-in, instead of inconsistent.


I highly doubt it's production code. Nobody uses both objects(pointers) and interfaces simultaneously. It's a quick way to disaster. In practice Delphi/FPC interfaces serve their purpose.


Swift also does Reference counting, the difference is huge. Speed of code is in another level. I am new to Lazarus, but I am guessing they do the same as Delphi.


I would love to switch off Delphi, but I'm heavily dependent on spring4d which is Delphi only right now. I may build some smaller programs or utilities in Lazarus.


do you know what UI kit is used on Linux?


There are options for both GTK and Qt.


Very nice, I will take a look.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: