Recent

Author Topic: Annoying issues in Object Pascal - what are those?  (Read 21102 times)

jacmoe

  • Full Member
  • ***
  • Posts: 249
    • Jacmoe's Cyber SoapBox
Annoying issues in Object Pascal - what are those?
« on: February 12, 2017, 05:14:32 pm »
I have been following Lazarus and Free Pascal for years..

I usually use C++ and Qt for desktop application development.
I never cared for C# and .NET.
Probably because I became a Delphi addict in 1997.
(I left that for C and C++ because I wanted to do graphics programming, and because Borland screwed up)..

I have read the excellent article Quick Modern Object Pascal for Programmers

In my mind, compared to other languages, modern Object Pascal does feature of lot of good things: properties, interfaces, classes, even low level stuff like pointers and memory management.

I am tired of C++, and having a break from it, devoting my time to learn proper C (c11), Rust, Python and Racket (Scheme).

But, when I picked up Lazarus - finally, a week ago, because the time was right! I noticed that I was actually writing fully featured desktop applications easily. Using modules, abstract interfaces and other advanced stuff that would have taken a lot of effort in other languages.

I know that a lot of people are using Javascript for user interfaces and they even create desktop applications in it. Kudos to them. I am not going to touch that!

OK.
So, what's the catch?

.. as much as I enjoy coding in Object Pascal, it DOES have a variety of annoying limitations that simply aren't present in other languages.) What does all this mean? In my opinion, it means FPC and Lazarus have far more "on their plate" that most people think: without them, Object Pascal would almost certainly drift completely into the "legacy" category.

I have enough experience with programming languages to know that nothing is perfect.
But I am curious - what are those annoying limitations?

For me, what I really like:
easy deployment
no runtime
painless cross compilation
properties and event handling without a complicated MOC compiler
you don't have to be a language lawyer to use advanced features
« Last Edit: February 12, 2017, 05:21:28 pm by jacmoe »
more signal - less noise

Thaddy

  • Hero Member
  • *****
  • Posts: 14210
  • Probably until I exterminate Putin.
Re: Annoying issues in Object Pascal - what are those?
« Reply #1 on: February 12, 2017, 05:19:41 pm »
Me too ....


Always boils down to the same:
- first they're gonna mention anonymous methods.... I predicted it first...
- then they mix up strongly typed compiled languages with dynamic languages
- then they start complaining about missing features that in reality are just libraries
etc.
« Last Edit: February 12, 2017, 05:28:14 pm by Thaddy »
Specialize a type, not a var.

jacmoe

  • Full Member
  • ***
  • Posts: 249
    • Jacmoe's Cyber SoapBox
Re: Annoying issues in Object Pascal - what are those?
« Reply #2 on: February 12, 2017, 05:51:05 pm »
I am looking at the foundation page, and it looks like anonymous functions is being worked on.

I don't know how active the projects are - Lazarus and Free Pascal, but it doesn't look too bad.

I do like that it is open source.

I almost forgot to mention another feature that I really appreciate:
Unit compilation.
Compile once!
How awesome is that, compared to C++, when working on larger projects.
A small change, and then you have to wait for a looooooong compile..

That this is a strongly typed compiled language is one of the major features of FPC.
« Last Edit: February 12, 2017, 05:58:27 pm by jacmoe »
more signal - less noise

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Annoying issues in Object Pascal - what are those?
« Reply #3 on: February 12, 2017, 06:01:36 pm »
But I am curious - what are those annoying limitations?

Offhand, nothing pops into my head as being an "annoying limitation" for me personally, so let me rephrase the question: What would keep someone coming from another language from landing on Pascal and sticking? Or, perhaps, what would someone coming from another language miss as they begin writing little test apps to see if Pascal is right for them?

Well, say you're coming from Python. As you write those little test apps, you might find yourself missing...

- Doing multiprocessing in 5 lines of code.

- Opening, parsing and working with a CSV file in 5 lines of code.

- Tuples as function return values (without declaring it as a type). (Swift has this too.)

- Indenting to indicate code blocks instead of begin/end or braces. Surprisingly, this is a feature I found myself liking about Python. Not only does it dispense entirely with begin/end and braces, making for cleaner-looking code, it also forces programmers to indent consistently.

That sort of thing.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Annoying issues in Object Pascal - what are those?
« Reply #4 on: February 12, 2017, 06:14:27 pm »
As Phil demonstrates, most of those arguments are highly subjective. (well actually, the tuples bit is a hard fact, though returning a dynamic array of variant will get you far in many cases).

IMHO it is the usual overfocus on language, one can bicker about minor variations and omissions at infinitum, but they really don't save that many time anymore when the base requisites are met.

More interesting is to consider that that desktop apps are Delphi/Lazarus home turf. If you want to find defects you will have to go out of that comfortable bubble, to webapps, service apps etc. Yes they are possible, and there are some frameworks, but none as complete and dominant as LCL is for desktop apps.

Then there are other aspects, like quality of debugging (weak compared to commercial offering), no cheap shared hosting for webapps (like PHP or to some degree asp.net).
« Last Edit: February 12, 2017, 06:16:48 pm by marcov »

jacmoe

  • Full Member
  • ***
  • Posts: 249
    • Jacmoe's Cyber SoapBox
Re: Annoying issues in Object Pascal - what are those?
« Reply #5 on: February 12, 2017, 06:20:03 pm »
That you need to declare variables in a separate section before being able to use them - sort of like old C - could be seen as an annoying issue by some.
Personally, I like that, because it forces you to think a bit more, and it also makes it easier to overlook the code.

I don't mind the 'begin - end' blocks - I am used to curly braces in C / C++.

Python is a different beast (a snake) than Lazarus/FPC (a cheetah) - it is very expressive. And I enjoy it. But I wouldn't use it for larger projects.

Opening and parsing and working with a CSV file with LCL is probably just a matter of dropping a CSV component on a form and use it in an action with a file dialog.
Probably not 5 lines, but extremely rapid.
more signal - less noise

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Annoying issues in Object Pascal - what are those?
« Reply #6 on: February 12, 2017, 06:22:35 pm »
Then there are other aspects, like quality of debugging (weak compared to commercial offering), no cheap shared hosting for webapps (like PHP or to some degree asp.net).

Right, it's not the language per se that has kept Pascal out of Web apps, or mobile development, or even whole areas of programming. Case in point: GIS. Join the "community of one" and do GIS with Pascal (https://macpgmr.github.io/MacXPlatform/PascalDynLibs_3.html) or join the thousands of Python developers who have been doing GIS for years (http://plugins.qgis.org/plugins)?

Pascal itself is quite adaptable. For example, it even fits into the world of Xcode and Objective C pretty well (https://macpgmr.github.io/MacXPlatform/WebAppOverview_3.html#EmbeddedBrowser). It's just that nobody embraces it in these new areas.

jacmoe

  • Full Member
  • ***
  • Posts: 249
    • Jacmoe's Cyber SoapBox
Re: Annoying issues in Object Pascal - what are those?
« Reply #7 on: February 12, 2017, 06:27:26 pm »
More interesting is to consider that that desktop apps are Delphi/Lazarus home turf. If you want to find defects you will have to go out of that comfortable bubble, to webapps, service apps etc. Yes they are possible, and there are some frameworks, but none as complete and dominant as LCL is for desktop apps.
Yes, indeed.
I am aware that desktop applications is not exactly 'what everyone is doing' these days.
However, if you want to do that, what options are there?
Java? With clunky syntax, huge libraries and a runtime to boot?
.NET (C#) with runtime requirement?
C++ and Qt with complexities and MOC compilers?
Or WxWidgets with C++ and MFC-like macros?

For me, Lazarus definitely makes desktop application development great again.

Right, it's not the language per se that has kept Pascal out of Web apps, or mobile development, or even whole areas of programming. Case in point: GIS. Join the "community of one" and do GIS with Pascal (https://macpgmr.github.io/MacXPlatform/PascalDynLibs_3.html) or join the thousands of Python developers who have been doing GIS for years (http://plugins.qgis.org/plugins)?

Pascal itself is quite adaptable. For example, it even fits into the world of Xcode and Objective C pretty well (https://macpgmr.github.io/MacXPlatform/WebAppOverview_3.html#EmbeddedBrowser). It's just that nobody embraces it in these new areas.

I find Object Pascal to be surprisingly modern. But, you are right: there is a lot of power in numbers.
« Last Edit: February 12, 2017, 06:31:38 pm by jacmoe »
more signal - less noise

jacmoe

  • Full Member
  • ***
  • Posts: 249
    • Jacmoe's Cyber SoapBox
Re: Annoying issues in Object Pascal - what are those?
« Reply #8 on: February 12, 2017, 06:51:23 pm »
Tuples as return values would be really nice to have.
But that's not really a limitation of the language per se..
I see that Free Pascal is constantly being improved - it is evolving - so perhaps it will be implemented some day.

I am more interested in more underlying issues - Akira has a list of "annoying issues that other languages simply does not have" - that makes me curious!
more signal - less noise

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: Annoying issues in Object Pascal - what are those?
« Reply #9 on: February 12, 2017, 06:57:04 pm »
.. as much as I enjoy coding in Object Pascal, it DOES have a variety of annoying limitations that simply aren't present in other languages.) What does all this mean? In my opinion, it means FPC and Lazarus have far more "on their plate" than most people think: without them, Object Pascal would almost certainly drift completely into the "legacy" category.

I have enough experience with programming languages to know that nothing is perfect.
But I am curious - what are those annoying limitations?

I was actually mostly referring to Delphi specifically when I said that, as part of the overall point I was trying to make that FPC/Lazarus are the future of Object Pascal and Delphi isn't. For example, I can't count the number of times I've been at work and really wanted to use a string-based case statement, only to remember that only FPC supports that.
« Last Edit: February 13, 2017, 12:31:43 am by Akira1364 »

jacmoe

  • Full Member
  • ***
  • Posts: 249
    • Jacmoe's Cyber SoapBox
Re: Annoying issues in Object Pascal - what are those?
« Reply #10 on: February 12, 2017, 07:03:12 pm »
That's great to hear!

It is also my impression that Object Pascal, as implemented by FPC/Lazarus, has moved beyond whatever Delphi (and other Pascal implementations) has to offer.
more signal - less noise

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Annoying issues in Object Pascal - what are those?
« Reply #11 on: February 12, 2017, 07:09:38 pm »
I am aware that desktop applications is not exactly 'what everyone is doing' these days.
However, if you want to do that, what options are there?

Well, leaving aside that it's 2017 and not 2007, one way to approach this question is to lay out the app requirements and work toward a tool, rather than start with a tool and work toward the app.

For example, is this hobby work? If so, then pick anything that's fun to use. If that's Lazarus, fine. No consequence whatsoever if you make the wrong choice.

Commercial work? For example, consumer-facing app. Well, you'd probably want to submit it to Apple's App Store and Microsoft's store, so for me that would mean using Xcode on the Apple side and Visual Studio on the Windows side, the idea being that you don't want to face _any_ limitations on the platform side and you don't want to risk a rejection at submission time. Write the app twice? Not a happy thought, but maybe put the non-UI code into a dynamic library so you can use it unchanged in both apps. I don't know anything about MS's store requirements, but Apple permits dynamic libs (.dylib) as part of a submitted app bundle. (And remember, now you're not too far away from iOS.)

Business-to-business work? Does the company expect source code too? Will they be extending it? Do they have code of their own they want to add? Etc. Again, let the app requirements drive the choice of tool.

jacmoe

  • Full Member
  • ***
  • Posts: 249
    • Jacmoe's Cyber SoapBox
Re: Annoying issues in Object Pascal - what are those?
« Reply #12 on: February 12, 2017, 07:23:01 pm »
I agree.

I am not really talking about larger shops for whom shipping apps on the Apple app store and the MS store is going to be a viable option.
And who has the funds to cover licenses, subscription fees, whatever.

Smaller shops, however.
And let's not forget about tool building. There is a lot of tools being developed and used in-house.
I think Lazarus offers a compelling alternative to .NET, Python (with GUI).

Whatever makes you productive!

I am well aware that I probably ain't going to be using Lazarus/FPC on the day job.

But that is on a tangent, because this topic is really about Object Pascal as a language (as implemented by Lazarus/Free Pascal).


Edit:
The same reasoning could be made about other 'fringe' languages / technologies, like Racket, Lisp, OCaml - this is the reason why good old C++ is still going strong.. despite the fact that it really isn't suitable for desktop GUI applications.
« Last Edit: February 12, 2017, 07:27:27 pm by jacmoe »
more signal - less noise

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Annoying issues in Object Pascal - what are those?
« Reply #13 on: February 12, 2017, 07:27:04 pm »
And who has the funds to cover licenses, subscription fees, whatever.

Sorry, not following you here. Explain a bit?

jacmoe

  • Full Member
  • ***
  • Posts: 249
    • Jacmoe's Cyber SoapBox
Re: Annoying issues in Object Pascal - what are those?
« Reply #14 on: February 12, 2017, 07:30:33 pm »
Windows is not free. Visual Studio is not free if you want to create apps for Windows Phone.
I know next to nothing about Apple, but don't you need to be in their developer program?
more signal - less noise

 

TinyPortal © 2005-2018