Recent

Author Topic: Things Lazarus/FPC can do Delphi cannot?  (Read 29594 times)

snorkel

  • Hero Member
  • *****
  • Posts: 789
Things Lazarus/FPC can do Delphi cannot?
« on: December 04, 2012, 05:19:47 pm »
Since I have been using Lazarus I have discovered a couple of little gems I could never do in Delphi:
(these don't work in Delphi mode)

Case with Strings:

case mystring of
      'one':showmessage('bla');
   end;

+= operator for concatenation

mystring:= 'bla bla'#13#10;
mystring+='yada yada yada'

Anyone else have some gems to share?
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 1.8 and FPC 3.0.4
OS: Windows 10 64 bit

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5404
    • wiki
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #1 on: December 04, 2012, 06:39:32 pm »
All open-source

As for the IDE: Codetools keep working while debugging an app. From what I hear, in Delphi while debugging you can not use code completion/navigation?

Afaik, more code completions. http://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools (see Identifier_Completion); Does Delphi has all of them?

Way advanced codefolding in the editor

Highlight of matching begin/end (There is a 3rd party tool for Delphi though) http://wiki.lazarus.freepascal.org/New_IDE_features_since#block_matching

Faster editor (at least compared to some Delphi, have not tested the latest): Load a huge (300.000 lines) file; "select all"; Delphi used to give you time for a coffee.

Debugger, while it lacks many things, it has a history and can show you the previous values of watches.

Faster startup (again have not tested latest Delphi)

Upcoming in 1.1 (currently only 32 bit Intel / 64 bit intel is being worked on / possible ppc on MAC) : PascalScript Macros to control the editor.

« Last Edit: December 04, 2012, 06:41:22 pm by Martin_fr »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8074
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #2 on: December 04, 2012, 06:43:23 pm »
Before that, state which Delphi version you are referring. Case with strings AFAIK is available in recent version (XE and up). C-style operators don't though (but is more like a flaw than feature to me). These things are Free Pascal only:

garlar27

  • Hero Member
  • *****
  • Posts: 594
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #3 on: December 04, 2012, 07:12:56 pm »

Faster editor (at least compared to some Delphi, have not tested the latest): Load a huge (300.000 lines) file; "select all"; Delphi used to give you time for a coffee.


Some times I need to use log and debug files . To spot faster some data on the log I use C highlighting and it works fine for me. I used to use Notepad++ on windows and gedit on Linux but when the log is huge +300K lines to 600k lines I can't use them. But Lazarus runs smoothly even when using the mouse wheel and with a selected text that lights up all the file like a Christmas tree!!!

ttomas

  • Full Member
  • ***
  • Posts: 178
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #4 on: December 04, 2012, 07:33:02 pm »
bitpacked record like c/c++

type
bit = 0..1;

BitsInaByte = bitpacked record
        bit0   : bit;
        bit1   : bit;
        bit2   : bit;
        bit3   : bit;
        bit4   : bit;
        bit5   : bit;
        bit6   : bit;
        bit7   : bit;
    end;

snorkel

  • Hero Member
  • *****
  • Posts: 789
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #5 on: December 04, 2012, 08:30:37 pm »
Before that, state which Delphi version you are referring. Case with strings AFAIK is available in recent version (XE and up). C-style operators don't though (but is more like a flaw than feature to me). These things are Free Pascal only:

Nope, not in XE and up:
I have Xe2 and it does not work.

[DCC Error] abu_formU.pas(90): E2001 Ordinal type required
[DCC Error] abu_formU.pas(91): E2010 Incompatible types: 'Integer' and 'string'

I have Xe3 as well, but have not installed it.   Borcadero has been against the case with strings for years.
But according to the docs even Xe3 does not have the ability.
http://docwiki.embarcadero.com/RADStudio/XE3/en/Declarations_and_Statements#Case_Statements
You can use a CHAR in a case, but not a string.
« Last Edit: December 04, 2012, 08:32:08 pm by snorkel »
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 1.8 and FPC 3.0.4
OS: Windows 10 64 bit

Leledumbo

  • Hero Member
  • *****
  • Posts: 8074
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #6 on: December 05, 2012, 07:30:20 am »
Quote
Nope, not in XE and up:
I have Xe2 and it does not work.

[DCC Error] abu_formU.pas(90): E2001 Ordinal type required
[DCC Error] abu_formU.pas(91): E2010 Incompatible types: 'Integer' and 'string'

I have Xe3 as well, but have not installed it.   Borcadero has been against the case with strings for years.
But according to the docs even Xe3 does not have the ability.
http://docwiki.embarcadero.com/RADStudio/XE3/en/Declarations_and_Statements#Case_Statements
You can use a CHAR in a case, but not a string.
OK, I guess we're one step ahead Delphi for this :D

teos

  • Full Member
  • ***
  • Posts: 145
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #7 on: December 06, 2012, 03:37:22 pm »
Then again.. Delphi has a very advanced remote debugger. Delphi has MUCH smaller executables... There are a very, very, very big lot of third party components which add a   very big lot of funcionality, from a much bigger group of users..

Lazarus has:
1. No native client-server databases in Lazarus,
2. No native remote debugger,
3. No bigger IDE component framework like DevExpress or JVCL. A lot of needed functionality/components have to be coded by hand.
4. Missing components like on Torry (or I have missed/not found it yet).
5. No decent web-framework like VCL for the Web.

So I can live without the strings in case statement (wondering about the big advantage over a enumeration or a decent if-then-else if) and the bitpacked record will have some decent alternative in Delphi too. What is the advantage over having something that is in a language like C or C++ if more imporant functionality is missing??

I would love to move to Lazarus and I have deep respect for everyone involved in FreePascal and Lazarus. Don't let there be any doubt about that. But untill now, the things Delphi can or has over Lazarus are too many.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8074
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #8 on: December 06, 2012, 03:48:27 pm »
Quote
Delphi has MUCH smaller executables...
Are you sure with the FM? A friend of mine shows that it's bigger than LCL-powered counterpart.
Quote
No native client-server databases in Lazarus
What would be the advantage of this over having bindings for many common dbms?
Quote
No bigger IDE component framework like DevExpress or JVCL. A lot of needed functionality/components have to be coded by hand.
3rd party support problem, not really a Lazarus problem. In fact, many other functionalities are available (though mostly undocumented) in FCL (content template, expression parsing, json, http server/client, encryption, and more that I can't list all of them).
Quote
Missing components like on Torry (or I have missed/not found it yet).
Same as above, partially solved by Lazarus-CCR (contribute please!)

Quote
But untill now, the things Delphi can or has over Lazarus are too many.
But it doesn't run on Linux... (most important thing for me, as it's my primary OS now)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #9 on: December 06, 2012, 04:00:44 pm »
1. No native client-server databases in Lazarus,
Do you mean that Delphi provides native object FPC units that directly connect to db servers without any need for DLLs? Seems like those Delphi guys have been reinventing the wheel as well as inviting a maintenance nightmare... but it would be impressive.
Or do you mean that there is some database server programmed in Delphi available for Delphi programs?

2. No native remote debugger,
You can debug with gdb over SSH if your target platform is *nix, AFAIU... Haven't tried it though.

I would love to move to Lazarus and I have deep respect for everyone involved in FreePascal and Lazarus. Don't let there be any doubt about that. But untill now, the things Delphi can or has over Lazarus are too many.
I understand your sentiments. Fortunately, Lazarus is improving all the time ;)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

teos

  • Full Member
  • ***
  • Posts: 145
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #10 on: December 06, 2012, 04:13:26 pm »
LCL (the first choise in create new project), empty form is 14,6 MB, delphi 2007 same new project, empty form is 407 kb.

Delphi has the same "bindings". External or not, there are also client-server databases, written in native Delphi, based on components. That gives you total ownership of both client and server, along with control over who is accessing your data and who is not. Not to mention that most of the common dbms-es run on Windows, not on Linux.

3rd party support problem or not, fact remains that DevExpress and Jedi VCL only excist for Delphi. So do most of the reporting engines. I learned that it is very hard to port Delphi components to Lazarus if you don't have a very thorough knowledge of Lazarus (and lots of spare time).

You mention documentation allready..

Maybe Lazarus CCR is not too easy to find..


BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #11 on: December 06, 2012, 04:24:55 pm »
LCL (the first choise in create new project), empty form is 14,6 MB, delphi 2007 same new project, empty form is 407 kb.
Yep. Read the "size matters" wiki article. If after reading that it that is a problem to you... well... to each his own.

Delphi has the same "bindings". External or not, there are also client-server databases, written in native Delphi, based on components. That gives you total ownership of both client and server, along with control over who is accessing your data and who is not.
Well yes. Same applies if you use an open source C/C++/whatever database. Once again, to each his own.
That said, if you want to upgrade e.g. the existing TDBF code to provide client/server functionality and e.g. an SQL layer, I'd certanily not stop you ;)

Not to mention that most of the common dbms-es run on Windows, not on Linux. 
Not sure what does has to do with anything - I must be misunderstanding you. Oracle, Firebird, Interbase, MySQL, MS SQL Server, PostgreSQL all run on Windows and all have native SQLDB connectors in Lazarus. Then again, many of them run on *nix too, yes.
Also, I'd think that most data centers/bigger companies run their dbs on anything but Windows... and the SME world perhaps still does things mostly on Windows... Laz (and Delphi) can deal with both, I'd think.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

teos

  • Full Member
  • ***
  • Posts: 145
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #12 on: December 06, 2012, 04:26:27 pm »
Do you mean that Delphi provides native object FPC units that directly connect to db servers without any need for DLLs? Seems like those Delphi guys have been reinventing the wheel as well as inviting a maintenance nightmare... but it would be impressive.
Or do you mean that there is some database server programmed in Delphi available for Delphi programs?

I wonder if you point out my bad explaining or if you are asking this.
Offcourse: database server programmed in delphi available for delphi programs.

2. No native remote debugger,
You can debug with gdb over SSH if your target platform is *nix, AFAIU... Haven't tried it though.
So not natively.. and if 'm correct: unix -> linux.
I would love to move to Lazarus and I have deep respect for everyone involved in FreePascal and Lazarus. Don't let there be any doubt about that. But untill now, the things Delphi can or has over Lazarus are too many.
I understand your sentiments. Fortunately, Lazarus is improving all the time ;)
[/quote]
Yes. Glad it is. Hope that I can edit my post and add Lazarus for Android.

Maybe offtopic for my initial remark but I tried to port all kinds of components, running into the differences with RTTI etc. Maybe I suggest one day that the main page of the Lazarus website could be better used to point to documentation sections and make the release announcements less important.
I do stronly prefer Lazarus. But some of the things I plan to port, I want to make commercial or at least closed source. I have to make a living somehow and I prefer cross platform -> Lazarus.
But if I don't give away my ideas in questions on the forum, I will not have something ready for quite some time from now unless in Delphi..

User137

  • Hero Member
  • *****
  • Posts: 1790
    • Nxpascal home
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #13 on: December 06, 2012, 04:29:58 pm »
Quote
..
I have Xe2 and it does not work.
..
Borcadero has been against the case with strings for years.
OK, I guess we're one step ahead Delphi for this :D
Hmm, yes and no. I guess they want to encourage the use of more optimal ways. Case strings, and string comparison in general is extremely slow compared to indexing and all kinds of other ways.

But i guess it's ok if language supports it, and if it's used for small things. But there could be developers that take this into larger projects and hurt its performance.

teos

  • Full Member
  • ***
  • Posts: 145
Re: Things Lazarus/FPC can do Delphi cannot?
« Reply #14 on: December 06, 2012, 04:34:18 pm »
LCL (the first choise in create new project), empty form is 14,6 MB, delphi 2007 same new project, empty form is 407 kb.
Yep. Read the "size matters" wiki article. If after reading that it that is a problem to you... well... to each his own.
Won't keep me from using Lazarus. Delphi executables don't grow to 15 MB with only an empty form. But I could understand if the exe size is due to compiling everything installed in Lazarus.

Delphi has the same "bindings". External or not, there are also client-server databases, written in native Delphi, based on components. That gives you total ownership of both client and server, along with control over who is accessing your data and who is not.
Well yes. Same applies if you use an open source C/C++/whatever database. Once again, to each his own.
That said, if you want to upgrade e.g. the existing TDBF code to provide client/server functionality and e.g. an SQL layer, I'd certanily not stop you ;)
I would if the code would make sense but it looks like spagetti. If I would upgrade it, I would use Tquery for SQL layer. But again: spagetti. I have tried to port TQuery but gave up on the goto's and pointers.

Not to mention that most of the common dbms-es run on Windows, not on Linux. 
Not sure what does has to do with anything - I must be misunderstanding you. Oracle, Firebird, Interbase, MySQL, MS SQL Server, PostgreSQL all run on Windows and all have native SQLDB connectors in Lazarus. Then again, many of them run on *nix too, yes.
Also, I'd think that most data centers/bigger companies run their dbs on anything but Windows... and the SME world perhaps still does things mostly on Windows... Laz (and Delphi) can deal with both, I'd think.
[/quote]
That is where my remarks about native Lazarus client-servers are about: in that case both would run on the same OS.