Recent

Author Topic: How does Pascal stack up vs the new languages  (Read 22292 times)

Benjiro

  • Guest
How does Pascal stack up vs the new languages
« on: May 19, 2017, 01:55:33 pm »
Hi all ...

I am currently in the market for a base programming language. The goal is by next year to create a company that will mostly focus on a web based product ( but with  desktop / mobile access ), large cluster environment etc.

In the last half year, i have been comparing a whole series of languages to be considered as a potential base language. With criteria like programming speed, memory safe, concurrency, platform support, memory usage, developers availability, ease of learning, ... and the list goes on. The project will mostly be developed on Windows systems, deployed on Linux servers. Potential targets are also Windows Desktop/And/Or Background process, Mac, Android, iOS.

So far my list of competing languages has dropped to:

* Rust: Interesting and safe concept, but difficult learning curve. Few developers. Editor support is growing but still in infancy.
* Swift: Easy to learn but platform depended a bit too much on Apple. Linux is more or less second tier and Windows is non-existing. Editor support on Windows is as good as non-existing.
* C#: Large developers market, multi platform support ( .Net Core ) but large memory footprint and wasteful performance. Great Editor support.
* D: Potential, fast, fits more of the criteria but community seems small. Editor support again issue.

More by accident, as i programmed in Pascal / Delphi 20 years ago ( Gave up after Delphi 7 with the whole Borland situation), i remember there being a open source alternative to Pascal. And here i am. I need to admit having a bit of a C bias thanks to years of using C style languages.

And as i have a series of questions, sorry if they sound silly. I am trying to base my information on 20 years out of date information.

* How stable is FreePascal?

* How memory safe is FreePascal? Is unsafe still supported?

* How is the Editor/IDE support? I assume everybody uses Lazarus?

* Is programming a Linux Webserver a issue? This sounds silly but i remember in the past ( my work was mostly desktop based ) that Delphi has some issues for web applications and cross platform etc.

* How is the performance ( CPU en Memory ) these days compared to C / or the new LLVM backed languages.

* How is the multithread overhead?

* How big is the Pascal community? Potential employees in North-Spain, Bilbao area ( What will be our target for starting the company ).

Technically Pascal is a bit late entry in my selection because the other languages all have there advantages and disadvantages. Making a final assessment more product. I do not plan on rewriting the production code by picking the wrong language, so long term stable platform, active development, community etc are also all on my list :)

There are plenty more questions in my head but better start with some basic ones. :D

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How does Pascal stack up vs the new languages
« Reply #1 on: May 19, 2017, 02:20:29 pm »
* Swift: Easy to learn but platform depended a bit too much on Apple. Linux is more or less second tier and Windows is non-existing. Editor support on Windows is as good as non-existing.

Swift on Linux is on par with Swift on Mac.

Visual Studio Code supports Swift syntax (along with most other languages, including Pascal) and is available on Windows, Linux and Mac.

But you are correct, there doesn't seem to be much activity with Swift on Windows even though it's open source. Perhaps MS has enough on its plate with the languages it supports.

sky_khan

  • Guest
Re: How does Pascal stack up vs the new languages
« Reply #2 on: May 19, 2017, 02:42:08 pm »
* Pretty stable, I think
* It is still unsafe. You need to alloc/free your objects and records manually.
* Lazarus had a long way. Its not bad. Even better than D7 in some ways.
* I'm not aware of any framework that resolves C10K problem. So it depends on number of clients you need to serve.
* Not efficient as much as C. Not good at some areas like heavy floating point calculations
* Not sure
* Much less than other languages you mentioned, I think. One in ten at best.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How does Pascal stack up vs the new languages
« Reply #3 on: May 19, 2017, 02:42:59 pm »
I am currently in the market for a base programming language. The goal is by next year to create a company that will mostly focus on a web based product ( but with  desktop / mobile access ), large cluster environment etc.

I'm not sure I would limit myself to only one language for a project of that scope. I would guess that to hit all those targets more than one language will be required - that's just a reality these days.

I know nothing of Rust or D, but keep in mind that if you need to create dynamic libraries (dll / so / dylib), not too many languages can do that. Normally C++ is used, but Pascal also works fine. You don't use C# or Swift to create a dynamic library. The advantage of dynamic libraries of course being that you can use them with any language and on any platform.

I'm surprised you don't have Python on your list.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: How does Pascal stack up vs the new languages
« Reply #4 on: May 19, 2017, 03:01:03 pm »
hi!
* freepascal compiler is absolutely stable
* lazarus as IDE is more than ok
* several implementations of webservers exists .. take a look on the brook framework and also my own UltraMachine web app back-end (it's in early stage but quite usefull)
* as i know multi-threading is stable on linux and windows
* no multi-threading overhead except the usual synchronization stuff
* memory management is stable and secure if you know what you are doing.
* speed is fantastic ... in some cases even better than c or c++ but it depends on the quality of the code you wrote
* cross platform dev is one of the strongest side of freepascal ... you can target several platforms with same code
   (as example i give you my back-end server - i write and test under windows but deploy under Debian on vps - no code modifications are needed at all i just upload Linux compiled exe on Debian and everything runs OK)
* community is friendly and 100% of the reasonable questions are answered within minutes .. max hour

one advice on web apps ... apart the pascal part on the server you need to learn js and html or another frontend  like react native

welcome to the community and good luck!
Speak postscript or die!
Translate to pdf and live!

Benjiro

  • Guest
Re: How does Pascal stack up vs the new languages
« Reply #5 on: May 19, 2017, 03:29:18 pm »
Swift on Linux is on par with Swift on Mac.

I beg to differ :)

Swift 3.1 is getting close ( Thank you IBM ) but there is still a lot missing from Foundation.

But you are correct, there doesn't seem to be much activity with Swift on Windows even though it's open source. Perhaps MS has enough on its plate with the languages it supports.

There is some development but its mostly coming from a few people. Microsoft is not going to invest time into Swift, when they have there own C# ( and Typescript what is very close to Swift syntax ).

one advice on web apps ... apart the pascal part on the server you need to learn js and html or another frontend  like react native

Trust me, that is not a issue. Those are the easy choices. Its the whole backend, performance, memory usage, etc ... Its a custom piece of work that ties into the profit model. Wasting resources there pushes up the cost. But people also cost money. So its looking for that balance that is the hard choice.

I'm not sure I would limit myself to only one language for a project of that scope. I would guess that to hit all those targets more than one language will be required - that's just a reality these days.

Call it laziness. Tired of learning new languages all the time and my position will be head developer for a while. Technically .netCore C# fits most of the marks but its the whole memory/performance, especially the JIT process eating too much memory.

Yes, its not easy to find a good language that is also fast, efficient and safe.

I know nothing of Rust or D, but keep in mind that if you need to create dynamic libraries (dll / so / dylib), not too many languages can do that.

No problem on those. They do fall back on dlsym and require the C type conversion as they simply export as C standard. Technically Go there plugin architecture ( 1.8 ) is the most clean and easy to use but also very new ( and still requires boiler plate ). Think Swift is the only one does that not require a lot of boiler plate ( given its Objective-C parent ).

Normally C++ is used, but Pascal also works fine. You don't use C# or Swift to create a dynamic library. The advantage of dynamic libraries of course being that you can use them with any language and on any platform.

I'm surprised you don't have Python on your list.

Too slow. Its on PHP level performance. Even PyPy brings it at best at C# level ( and trading memory for performance even more ). That is still taking a 3 to 5 times performance hit.

Thanks for the feedback guys. Ill give it a try tonight to see how much of my memory comes back. And ill try to run some tests.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: How does Pascal stack up vs the new languages
« Reply #6 on: May 19, 2017, 04:06:10 pm »
Swift on Linux is on par with Swift on Mac.

I beg to differ :)

Swift 3.1 is getting close ( Thank you IBM ) but there is still a lot missing from Foundation.

Well, technically Foundation is a library, not a Swift language feature, but I get your point. Foundation is used in just about all macOS, iOS, watchOS and tvOS apps, so it makes sense that developers would want to use it in Swift code targeting a Linux backend too.

https://github.com/apple/swift-corelibs-foundation

No problem on those. They do fall back on dlsym and require the C type conversion as they simply export as C standard. Technically Go there plugin architecture ( 1.8 ) is the most clean and easy to use but also very new ( and still requires boiler plate ). Think Swift is the only one does that not require a lot of boiler plate ( given its Objective-C parent ).

Similar approach in Pascal too, where the dynamic library has a C interface. Most C++ dynamic libraries do it that way too so they can be called by other languages.

I've found that putting Pascal code in a dynamic library is a great way to preserve its value in a rapidly changing landscape where you never know what platform or language you'll need to use it with or what the frontend will look like (Web app, mobile app, etc.).

Here are some notes on Pascal dynamic libraries:

https://macpgmr.github.io/MacXPlatform/PascalDynLibs.html

guest58172

  • Guest
Re: How does Pascal stack up vs the new languages
« Reply #7 on: May 19, 2017, 08:45:16 pm »
Quote
How memory safe is FreePascal? Is unsafe still supported?

Memory is unsafe in FreePascal. There no flow analysis or escape analysis, in the sense of D safety, that prevents usage of certain memory operations in code that's annotated "@safe".

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: How does Pascal stack up vs the new languages
« Reply #8 on: May 19, 2017, 11:07:22 pm »
I am currently in the market for a base programming language. The goal is by next year to create a company that will mostly focus on a web based product ( but with  desktop / mobile access ), large cluster environment etc.

(web/server and desktop programming are potentially conflicting requirements)

Quote from: Benjiro link=topic=36930.msg246677#msg246677
In the last half year, i have been comparing a whole series of languages to be considered as a potential base language. With criteria like programming speed, memory safe, concurrency, platform support, memory usage, developers availability, ease of learning, ... and the list goes on.

FPC doesn't do memory safe (as in GC or as in managed, though it has some more language protections than e.g. C ) and  concurrency (on a language level), while programming speed is relative (though that is more a compiler than a language thing in this class of languages).

Also it is one of the few open source projects with first level Windows support that is not based on some POSIX emulation.

Quote
The project will mostly be developed on Windows systems, deployed on Linux servers. Potential targets are also Windows Desktop/And/Or Background process, Mac, Android, iOS.

I'd say FPC's primary goal is all-round development system with a relatively low number of dependencies.  It would be fine for webdevelopment, but the libraries are still sub-par. (though maybe not compared to some other ones in this list)

This makes it very suitable for small and midsized development because that provides a certain ability to solve your own problems within one development system.

Quote
* Rust: Interesting and safe concept, but difficult learning curve. Few developers. Editor support is growing but still in infancy.

Who is really pushing this except Mozilla?

Quote
* Swift: Easy to learn but platform depended a bit too much on Apple.

Agree on the apple front. Wouldn't even show up on my radar.

Quote
* C#: Large developers market, multi platform support ( .Net Core ) but large memory footprint and wasteful performance. Great Editor support.

If your gravitas is on windows, this is a no-brainer

Quote
* D: Potential, fast, fits more of the criteria but community seems small. Editor support again issue.

Yes, though I would call it more loud/vocal than having potential IMHO.

Quote
More by accident, as i programmed in Pascal / Delphi 20 years ago ( Gave up after Delphi 7 with the whole Borland situation), i remember there being a open source alternative to Pascal. And here i am. I need to admit having a bit of a C bias thanks to years of using C style languages.

C the language, or superficial C-like syntax? Examine your own feeling young padawan, these are different things.

Quote
And as i have a series of questions, sorry if they sound silly. I am trying to base my information on 20 years out of date information.

* How stable is FreePascal?

Good for the core targets, less in the fringes. Relatively to other languages though, FPC's fringes are good though.

Quote
* How memory safe is FreePascal? Is unsafe still supported?

Define safe (managed or GCed ?)  FPC isn't either though. It is more C/C++ with a safer but not absolutely safe model. It just makes the unsafe bits rarer.

Quote
* How is the Editor/IDE support? I assume everybody uses Lazarus?

A very high percentage. Plugins exist for Idea, VSCode and Eclipse.  I don't know the those that well, I use Lazarus and Delphi. (though I use some netbeans based embedded IDE for non FPC projects, ugh)

Quote
* Is programming a Linux Webserver a issue? This sounds silly but i remember in the past ( my work was mostly desktop based ) that Delphi has some issues for web applications and cross platform etc.

A webserver, or a serverside web application? A webserver can be dragged on a form of a GUI app and will work. But that would be a far cry from something like what Apache provides.

Sufficient to say that both exist, but

Quote
* How is the performance ( CPU en Memory ) these days compared to C / or the new LLVM backed languages.

Bad in extremely high optimizable code like benchmarks (localized problems that give the compiler room for optimization), fair in most other aspects.

Quote
* How is the multithread overhead?

Since Pascal is generally on the C/C++ level, roughly the same. It is not a language thing though, Delphi e.g., while having the same language is better after D2009 because all synchronization primitive are guarded by a spinlock keeping overhead down. FPC mostly just interfaces to OS primitives without adding much.

Quote
* How big is the Pascal community? Potential employees in North-Spain, Bilbao area ( What will be our target for
starting the company ).

Locally the chance on Delphiers and ex-delphiers is probably easier than dedicated "FPC/Lazarus" ones.

If you can harness their arrogance, one can also employ C++ers. They usually have the skill, though the attitude is often a problem.

Quote
Technically Pascal is a bit late entry in my selection because the other languages all have there advantages and disadvantages. Making a final assessment more product. I do not plan on rewriting the production code by picking the wrong language, so long term stable platform, active development, community etc are also all on my list :)

There are plenty more questions in my head but better start with some basic ones. :D

If you are targeting web development to a high degree, I'd take a different language as core web language, but restrict it to the more high volume business code. Then I would implement the small tooling, some of the more core services (-daemons) in FPC.
« Last Edit: January 10, 2023, 05:01:40 pm by marcov »

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: How does Pascal stack up vs the new languages
« Reply #9 on: May 20, 2017, 01:36:00 am »
The project will mostly be developed on Windows systems, deployed on Linux servers. Potential targets are also Windows Desktop/And/Or Background process, Mac, Android, iOS.
It sounds like you should also take a look at mORMot and Smart Mobile Studio:
https://synopse.info/fossil/wiki?name=SQLite3+Framework
http://smartmobilestudio.com/
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Benjiro

  • Guest
Re: How does Pascal stack up vs the new languages
« Reply #10 on: May 21, 2017, 09:14:01 pm »
Thanks for the feedback. Here is some perceptions from test runs.

A simple socket program, that waits for a connection and dumped the content it receives back to the console.

C: 0.1MB memory usage.
C++: 0.2MB memory usage.
Rust: 0.4MB memory usage. Syntax is funky with unwrap at several spots.
FreePascal: 0.6MB memory usage.
Swift: 1.4MB memory usage. 0.3MB for a basic hello program without foundation but for anything else you need foundation= +1MB.
DLang: 1.6MB memory usage.

Its just some basic tests. Will do more pascal testing in the week.

While Lazarus is familiar to me, at the same time it felt a bit old fashion. No multiple workspaces/projects support. No files display left side like Visual Studio Code? It seems too much one single visual project designed? Or maybe i missed it somewhere?  Little bit odd how all the windows are lossy lossy. Remind me of Gimp in the past. No dark theme? Simply a color change in the editor ...

Did crash Lazarus editor: Press Tools - Example Projects and before the list loads press ESC. Instant memory violation. Seems somebody forget a check :D

Thaddy

  • Hero Member
  • *****
  • Posts: 14204
  • Probably until I exterminate Putin.
Re: How does Pascal stack up vs the new languages
« Reply #11 on: May 21, 2017, 09:23:52 pm »
C: 0.1MB memory usage.
C++: 0.2MB memory usage.
Rust: 0.4MB memory usage. Syntax is funky with unwrap at several spots.
FreePascal: 0.6MB memory usage.
Swift: 1.4MB memory usage. 0.3MB for a basic hello program without foundation but for anything else you need foundation= +1MB.
DLang: 1.6MB memory usage.
On more serious programs FPC scores usually better in memory use over all of the above.
Try and examine the results of the compiler shoot-out. Although that is not corrected yet for any newer versions of FPC.
Specialize a type, not a var.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: How does Pascal stack up vs the new languages
« Reply #12 on: May 21, 2017, 09:29:38 pm »
Thanks for the feedback. Here is some perceptions from test runs.

A simple socket program, that waits for a connection and dumped the content it receives back to the console.

C: 0.1MB memory usage.
C++: 0.2MB memory usage.
Rust: 0.4MB memory usage. Syntax is funky with unwrap at several spots.
FreePascal: 0.6MB memory usage.
Swift: 1.4MB memory usage. 0.3MB for a basic hello program without foundation but for anything else you need foundation= +1MB.
DLang: 1.6MB memory usage.

Such values for languages that are roughly on the same level are more governed by default values in the runtime library (size of stack, size of initial dynamic memory block, buffers used in startup etc, if they read zoneinfo etc etc) and don't say that much about the efficiency of the language.

However FPC usually scored well if you count totally loaded binary code (used shared libraries + exe). Picking the right value is quite difficult. See e.g.this topic on stackoverflow
 

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: How does Pascal stack up vs the new languages
« Reply #13 on: May 21, 2017, 09:33:28 pm »
While Lazarus is familiar to me, at the same time it felt a bit old fashion. No multiple workspaces/projects support. No files display left side like Visual Studio Code? It seems too much one single visual project designed?
You have these things in Lazarus but as additional packages that needs to be installed. Maybe you should take a look at Lazarus forks that might be more to your liking out of the box without that GIMP look, with multiproject support etc:
http://newpascal.org/
http://www.pilotlogic.com/sitejoom/index.php

This might also be of interest:
https://github.com/FlKo/LazarusDockedDesktops

I also suggest reading http://newpascal.org/assets/modern_pascal_introduction.html
« Last Edit: May 21, 2017, 09:36:40 pm by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

sky_khan

  • Guest
Re: How does Pascal stack up vs the new languages
« Reply #14 on: May 21, 2017, 09:36:26 pm »
Well, there is no support for multiple workspaces/projects.
There are some packages for docked IDE like more recent IDEs but IMO they're half baked. they're not installed default.

Menu-Project-Project Inspector shows and let you select used units(files) and packages in your project.
View-Code Explorer shows overview of your current unit in editor.
View-Code Browser let you search any identifier in Lazarus or in your project.
I couldnt reproduce crash. It shows all example projects instantly here. I have pretty fast desktop with ssd, sorry :)

 

TinyPortal © 2005-2018