Jump to content
Rinzwind

Delphi or Lazarus/Free Pascal

Recommended Posts

How would you compare Delphi to the offerings of Free Pascal and Lazarus? Anyone has real experience with using both? Why not use Free Pascal exclusively? Or is it lacking in some areas? Or you only use Delphi for old projects, and would choose Lazarus for new ones?

 

Just curious to what the state is of both as viewed by 'expert' Pascal programmers. Please only reply if you have indeed a decent amount of experience in using both.

 

One would think Delphi would have the better code editor/code writing help? But I am somehow doubting that. Someone can assure me? ;)

Share this post


Link to post

IMO: I've tried to run, after some changes because two languages are not fully compatible, a Delphi program to Lazarus, for Windows (my idea is to move some apps to Linux).
The performances of Lazarus compiled code are lower than Delphi compiled.

I've tried to move GLScene so 3D UI with bad results when compared, but working.

I've never tried then to move it to Linux using FreePascal.

Share this post


Link to post
Quote

Just curious to what the state is of both as viewed by 'expert' Pascal programmers.

"Expert" programmers use Delphi.

Lazarus / Free Pascal if not really compatible with the large Delphi ecosystem.

Share this post


Link to post

My 10 cents...

I have currently abandoned the idea of using FreePascal with x86/x64 Linux environments

pending how Delphi's native support for Linux will evolve.


Since I have the professional version, which does not support Linux, I am waiting to see in the next versions

what will happen on ARM support, and whether to migrate to the fuller version and update my entire dev system (at moment is 10.4.1).

For embedded, ARM-based Linux systems, Freepascal + Lazarus is currently a solution that I use occasionally, and although

it is very limited compared to Delphi it keeps me in a fairly well-known language/library.

LCL is not comparable to VCL but for small things in the hostile world of ARM, it may be okay for the time being.
 

Share this post


Link to post

I think that for ARM Linux you will have to wait quite a few more versions of Delphi. Unfortunately

Share this post


Link to post
1 hour ago, tgbs said:

you will have to wait

I can imagine a version of an IDE aimed at hobbyists that includes the Delphi ARM Linux compiler, Python 4 Delphi, FMX only, local database support for <=$99. I hope that EMB get more creative in going after markets that are there without the fear of reducing existing sales.

 

In and of itself the ARM Linux compiler is really important perhaps not attracting a high unit price but creating value for the rest of the product range. In addition making it possible to think about low priced and targeted SKUs.

 

  • Like 2

Share this post


Link to post
6 hours ago, Rinzwind said:

Why not use Free Pascal exclusively? Or is it lacking in some areas?

If a FOSS project does not get the expected attraction, despite decades of public existence, despite capable language (Object Pascal), then they have some strange (or not professional-grade) priorities. They are not attractive for new/more compiler developers.

  • Like 1

Share this post


Link to post
4 hours ago, pcoder said:

If a FOSS project does not get the expected attraction, despite decades of public existence, despite capable language (Object Pascal), then they have some strange (or not professional-grade) priorities. They are not attractive for new/more compiler developers.

Well well.. they seem to have that in common with Embarcadero. Just in a different way.

Share this post


Link to post

FPC/Lazarus pros:

- More features in language and in IDE

- More platforms supported

- Code tools correctly handle $IF blocks which Delphi can't for about 15 years

Cons:

- Debugger SUCKS

- Some Delphi features not available (RTTI, anonymous functions)

- IDE cannot fold procedures* - ridiculously missing the very important UI feature

 

added

* I mean "Fold ALL procedures" hotkey

Edited by Fr0sT.Brutal

Share this post


Link to post

 

14 minutes ago, Fr0sT.Brutal said:

- IDE cannot fold procedures - ridiculously missing the very important UI feature

Why? In Lazarus 2.0.10 everything folds nicely (both standalone procedures and methods):

 

2.thumb.png.30cd9cde6a7dab6c60184aa8a355756c.png

Share this post


Link to post
1 minute ago, Alexander Elagin said:

In Lazarus 2.0.10 everything folds nicely (both standalone procedures and methods):

Which command does this?

Edited by Fr0sT.Brutal

Share this post


Link to post

Duh. Sorry for unclear phrase. I meant "Fold ALL procedures" hotkey which I use frequently in Delphi.

Share this post


Link to post

Got it. Then alas, I do not think there is such option in Lazarus. I have never used it in Delphi, but it all depends on one's personal preferences and development style.

Share this post


Link to post
17 minutes ago, Fr0sT.Brutal said:

Duh. Sorry for unclear phrase. I meant "Fold ALL procedures" hotkey which I use frequently in Delphi.

Can't you find these in the options?

Tools > Options > Editor > Key mappings

(search for fold)

 

Alt+Shift+1 / 9 and Alt+Shift+0

 

Or does this not do what you want?

 

fDVaw1I.png

Share this post


Link to post
12 minutes ago, Alexander Elagin said:

Got it. Then alas, I do not think there is such option in Lazarus. I have never used it in Delphi, but it all depends on one's personal preferences and development style.

I was wrong ;-( There are in fact options to fold and unfold: Alt-Shift-1 to Alt-Shift-9 fold blocks of appropriate level, Alt-Shift-0 unfolds all.

3.thumb.png.5b11be76bfe7a28d8306962c380ccf53.png

Edited by Alexander Elagin

Share this post


Link to post
48 minutes ago, rvk said:

Can't you find these in the options?

No. Top-level procedures could have any folding level and there could be fragments of the same folding level which I do not want to fold (consider: class declaration - f.l. 1, routines = f.l. 1, methods inside a region - f.l. 2. You can never fold routines+methods and leave class decl in one call). And I obviously don't want to count which folding level I'm currently on (so this 1-9 hotkeys are absolutely useless feature IMHO).

Edited by Fr0sT.Brutal

Share this post


Link to post
1 minute ago, Fr0sT.Brutal said:

No. Top-level procedures could have any folding level and there could be fragments of any folding level which I do not want to fold. And I obviously don't want to count which folding level I'm currently on (so this 1-9 hotkeys are absolutely useless feature IMHO).

Which shortkey do you use for that in Delphi?

 

Alt+Shift+- and Alt+Shift+= will fold and unfold at the cursor.

 

Share this post


Link to post
9 minutes ago, rvk said:

Which shortkey do you use for that in Delphi?

Ctrl-K+M for methods, Ctrl-K+R for regions.

Anyway I want to tell the editor what I'm folding not where these fragments are in the code. I probably want to fold all long comments, or nested procedures inside current procedure only, or all methods of currently focused class, or anything except currently focused class... options are endless when the folding engine operates full-featured AST instead of filthy fold-tree

 

P.S. I added an example to my previous post

Edited by Fr0sT.Brutal

Share this post


Link to post
7 hours ago, Fr0sT.Brutal said:

- Debugger SUCKS

I've been using Laz/FPC since 10.4.2 because DelphiLSP was so bad.  The current version of Lazarus actually has a new debugger and there are a ton of improvements and fixes in the main branch ready to go for the next version.

 

Also the code folding in the Delphi IDE doesn't maintain its folded state and auto-expands the folded code below when you invoke code insight.  Here is what someone on stackoverflow says on how to reproduce it:


 

Quote

 

Create new application

Create two new event handlers for OnCreate and OnClose for your form or any two other methods.


procedure TForm1.FormCreate(Sender: TObject);
begin

end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  //
end;

In case if you created event handlers make sure there is at least some code in the lowest handler method or at least one commented line so that optimizer doesn't automatically remove the "empty" event handler.

Fold the bottom event handler code.  Now in top event handler write "Form1." and you will see how bottom event handler will be automatically expanded.

 

This still happens in 11.2.  It probably expands due to error insight thinking everything after "Form1." is an error but it should leave folded code alone.  This works as expected in Lazarus.

 

The next version of FPC will have better support for generics too.

Share this post


Link to post

The main reason for me to not seriously consider Lazarus was the debugger. It sucks. Now there apparently is a new one, so I should probably give it another try.

Share this post


Link to post

The new debugger is not at the level of the Delphi debugger yet but it has taken a (very) big step in the right direction.

 

Share this post


Link to post
12 hours ago, FaFaFooey said:

The current version of Lazarus actually has a new debugger and there are a ton of improvements and fixes in the main branch ready to go for the next version.

Okay, built FPC/Laz from trunk. Started debugging.

image.thumb.png.f43451014b0a0c4521e763db4d0e4c7e.png

Goodbye.

12 hours ago, FaFaFooey said:

Also the code folding in the Delphi IDE doesn't maintain its folded state and auto-expands the folded code below when you invoke code insight.

Yes, this is annoying. However, I find useful unfolding on a real error - I use to enter "(*" at some place to unfold everything below.

Share this post


Link to post
On 9/4/2022 at 11:02 PM, Rinzwind said:

Just curious to what the state is of both as viewed by 'expert' Pascal programmers

 

Since 1999, I've been hired numerous times because I'm an "expert" with DELPHI -- not merely with Pascal. I have never been asked about either FPC nor Lazarus for use in any sort of production capacity. They have language features that Delphi only dreams about, and they can be fun to play with. Even an educational institution I worked at for nearly 5 years kept their Delphi license current and the project head refused to even consider FPC or Lazarus.

 

Lately I've been shifting my focus over to TMS WebCore because I believe the future lies in web apps for generalized cross-platform needs, rather than a hodge-podge of separate platforms that are all evolving so fast that keeping track of them all in parallel with moving the common platform forward is an expensive exercise in chasing one's tail just to stay current.

 

TMS has also added the ability to encapsulate WebCore (or any web-based) apps to run as native apps using their Miletus technology.

 

Is this a panacea for all of the humonguous apps historically built with Delphi that have been around for more than a decade? Hardly.

 

But the last three jobs I've had all implemented a ton of stuff in core parts of their systems that could be moved without too much trouble into service-based instances running inside their own network. One was slowly moving in that direction for newer things, but I saw a ton of resistance elsewhere.

 

An earlier one was migrated from one DB to another. I know we could have done it in-house in about 4 months, but upper Management insisted they thought it would be better to outsource it. I have no idea what it cost, but probably over $500k, and it ran over by 50% before they pulled the plug and the other dev on our team finished it up in a few weeks. The whole thing could have been reimplemented in far less time as a REST-based service, but everybody thought that was just way too risky and that the performance would be really bad. They were just guessing, of course.

 

The bottom-line is ... Management sticks with what they know.

 

From what I've seen in most apps I've supported, there's a ton of stuff that can be easily factored-out and moved into REST-based services. There's also a lot of UI redesign that can be done to simplify different use-cases. What happens with these big desktop apps is they start out simple, then get warts added on top of warts until you have this huge, complex mess that's got all sorts of right-click options on virtually everything to deal with common needs that cannot be provided without severe change to the UI. 

 

Moving these horribly mutated ginormous desktop apps over to web apps without significant redesign is silly. But it's all that companies seem to think is warranted. Either that or it's like: "well, if we're going to rebuild it, there's no way in hell we'll use Delphi! We'd only consider C#/.NET in that case." I have personally never seen a single one of such redesigns ever completed on-time or within budget.

 

So I'm not doing Delphi work any more, because pretty much the only jobs I get hired for are maintaining ancient legacy Delphi apps where the company generally refuses to allow us "experts" to do any sort of refactoring. (I have always suspected that's because they usually have no automated test suites.) I honestly don't even know why they bother to hire Delphi "experts" because they never wanted to hear anything I suggested. My job was to simply fix bugs reported by customers and add the occasional feature that a customer pestered them to add -- and often paid for. 

 

All that to say, I don't think this has anything to do with "Pascal" at all. They know "Delphi", not "pascal". But if they were to switch, they'd rather switch to JavaScript, Python, Rust, and Go. Even C# is fading away.

 

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×