For Windows users, just use chocolatey and run:
`choco install lazarus`
...and you'll be up and running with (1) FreePascal compiler (2) Lazarus IDE (https://lazarus-ide.org) with integrated debugger and RAD (Rapid Application Development) GUI designer.
Lazarus and FPC can create high-quality native GUI's for macOS, Linux, and Windows. And many open-source 3rd party GUI components can be installed right from within the Lazarus IDE via the "Package" > "Online Package Manager" menu option.
I've been using Delphi and/or Lazarus + FPC for 15 years. It's truly the most productive way to build a GUI desktop application, and makes it extremely easy to build powerful console apps.
Sometimes I need to create a small GUI application for my Windows colleagues. Using Qt or .NET I get huge binaries/dependencies. What is the final binary size (all deps included) with your solution for a "hello world" GUI exe?
A sore point for me in .NET, given that Anders was on the team, was the lack of proper AOT compilation (NGEN did not really cut it), Delphi style.
We had to wait until Windows 8 to properly get it, and still its being rebooted due to the way WinRT went, whereas it could bave been there since v1.0.
"Bill Gates saw the success of Turbo Pascal "in very personal terms, and 'couldn't understand why [Microsoft's] stuff was so slow. He would bring in Greg Whitten [programming director of Microsoft languages] and yell at him for half an hour.' He couldn't understand why Kahn had been able to beat an established competitor like Microsoft.""
I came across a copy of QuickPascal for $19.99 from Surplus Software and used that for a while because my version of Turbo Pascal was old (2.0) and am the current one was $69.99, a lot of money since I was just a kid.
I've been working through the Advent of Code, doing it all in Lazarus/Free Pascal... the main limitation I've hit so far is in working out the logic, some of the puzzles are tricky. https://github.com/mikewarot/Advent_of_Code_in_Pascal
[Edit]
One of the nice things about pascal strings, and variable parameters, is that you can write functions like
getinteger(var s : string):integer;
Which literally pulls a sign plus digits from s, skipping spaces, until it hits a space, comma, etc... s gets shorter, you get the integer, and it just works.
I don't think that type of thing is even possible in C because of null terminated unmanaged strings.
int getint(const char **s) {
int res = 0;
for (; **s && isspace(**s); (*s)++);
for (; **s && isdigit(**s); (*s)++)
res = 10 * res + **s - '0';
return res;
}
For "out" variables, you can increase the indirection and pass a char** (pointer to a pointer) to the method as the argument.
Then the pointed-at pointer can be manipulated within the method body and changes will be visible on the outside as well, giving you both the numeric return value as well as the shortened string as the output. This is what the second argument of the strto{d,f,ld} function does: https://devdocs.io/c/string/byte/strtof
Sure, that happened months ago, but there was no announcement thread on HN. It is sad. So many programming languages get an announcement thread, but FPC is forgotten all the time.
edit: actually there was such a thread. I just missed it. But it had no comments
Something that has boggled my mind everytime I tried out Freepascal is its link time. This is something that I feel tends to get glanced over in Nim or D circles.
Both advertise fast compilation, and they do compile quickly, but my experience with even 5-10k loc projects with those languages start to see some time sunk into the linker, even with Gold. This will inevitably lead to the change-execute cycle taking 1-3 seconds, while I have had no issue with substantially larger fpc code bases compiling and running in milliseconds.
For Rust and C++ devs a change-execute cycle sub 10 seconds is incredibly enticing. However, fpc has ruined me for what fast compilation really means. It also makes me really wish Nim had stuck to fpc as a backend.
I know very little about what is actually going on behind the scenes here. If anyone has any info about pascals compilation as well as linkers in general I would love to know more.
I'm not sure if it's good form to reply to yourself here, but I did find this: https://lwn.net/Articles/276782/.
It appears to be a 20 part series from a(the?) Gold developer on Linkers.
It's funny you should say that, because to me FPC feels very slow. Delphi got me spoiled. Especially the older versions build (quite literally) in a blink.
I remember Pascal from highschool. It's a pretty good language, hard to believe it's 50 years old already. I remember how impressive it was that multiple different implementations existed, not just the the famous one from Borland, Turbo Pascal, but also the fact that it was implemented on 8 bit computers.
It's a real language. Skype for Windows was originally written in the Delphi dialect.
If you are doing any native Windows development and also need to interact with a lot of COM objects and apis it's really hard to beat Delphi. It's so much nicer than dealing with C++ and WTL.
It would be interesting to compare compilation speeds with Delphi. On a 2020 laptop I7 9900) with 16 GB of ram, I can compile a 1.3 million LOC Delphi program in 11 seconds. That's the 32-bit XE7, the 64-bit takes typically 25 seconds.
There are some of us who still work in Delphi. (Yes I know its not Freepascal)
Most of the Nordic ski industry runs on software written in Delphi: property management, cabin rentals, equipment, scheduling of classes and private lessons; the whole thing.
I spent 13 years developing and maintaining that system, around 2-3 MLOC at the time I left.
I found Delphi awesome in many ways but too enterprisey and too far removed from reality in others. Every few years a new technology would appear to replace the previous half baked attempt at solving the same problem, or dropped completely and replaced by third party components. Long term I found the software very frustrating to work with since everything about it was so volatile and there were so many random gaps in quality and functionality.
Their database, Interbase, was pretty good; and well integrated into the language/IDE. Open sourced and forked as Firebird SQL at one point.
I am aware of a Belgian company whose most software that they deliver is still done in Delphi.
Also here in Germany there is still a big enough community to warrant having Delphi conferences and articles in all major magazines that are language neutral, like Windows Developer one.
I did a good bit of my high school programming classes in Pascal; only much later in my life do I realize how much it taught me. Kind of miss it, actually.
I’ve never had any direct experience with Pascal (though I remember my dad telling me a story of an assignment he had in college to write a queue of queues in Pascal).
From the perspective of the Alan Perlis quote “A language that doesn’t affect the way you think about programming is not worth knowing,” is it worth it for me to give FreePascal a try? Or if I have experience in other procedural languages have I pretty much seen what it has to offer already?
The modules (called units) are a huge improvement for managing large projects. Also extremely fast in compilations.
The string handling are much better than C. Most is just automatically. You would not even encounter any difficulties until you start to interface with C libraries. And then it is still easy.
Due to this and strong typing and bounds-checking you automatically avoid most memory errors that you get in C. But you can make it as complicated as C, with pointers to pointers to arrays, disable bounds-checking/type-checking, etc.
There are some limited parametric type possibilities.
The disadvantage is the absence of closures/lambdas. Instead you have to make pointers to functions, like in C. Or use Objects like in Java. But with manual memory management.
The manual memory management and type declarations give extra overhead. Like in C. A lot would be avoided with inline variable declarations with automatic typing.
Pascal is unsurprising in a mostly good and sometimes frustrating way.
The syntax will be the primary barrier. Things like nested if-else with multiple conditionals are just a little more persnickity if you've been using C braces for decades. But the language, in the Borland dialects that most are using now, is somewhere in between C and C++ in terms of power overall: it's a little safer by default, still manual memory, but without needing to fling around quite so many pointers. And those compile times! A pretty well-suited language for game coding, actually.
And in terms of writing production code, libraries may or may not be a barrier. Basically, Pascal's current ecosystem exists in the shadow of one of the best RAD environments of the 90's - Delphi. That's where a lot of the code got written, and there's a definite focus on native desktop apps that remains. There are certainly good libraries available, but many are old, Delphi-centric, and lack polish - haphazard accumulations from developers that are very "get-er-done" and unconcerned about reuse. You can always bind C code, of course, but today it's easy to end up saying, "well, but I could just get a working library in (Go/Python/Node/etc) and be done" and thus end your Pascal journey before it starts.
In some ways, pascal had such an impact that many of its revolutionary ideas (structured programming) are now so commonplace as to be unremarkable.
The way primitive sets and enumerated types fit together is still a rarity, as far as I know. (You can accomplish the same things in any low-level language, but the pascal syntax make it really nice.)
Interfaces in pascal are fairly interesting because they allow you to implement your own addref/decref routines for automatic reference counting. This was made for COM, but you can plug it into whatever reference counting scheme you like (say if you want to write python extensions or whatever).
The main thing is still probably the component system though, and the tight integration with the development environment.
It's kind of a trip the first time you configure an IDE plugin and realize it just recompiled the whole IDE for you.
If you know C you 'know' Pascal. What the best thing about Pascal (and its successor Delphi) was the blazing fast compilation time and I am not sure that freePascal has that.
Also what I really hate about Pascal is it is dishonest. It tells you it is very structured and your code will be better because of limited expressiveness. But then the 'writeln' 'function' needs to be intruduced at the compiler level - you cannot write such a function in the Pascal grammar. (maybe with freepascal you can nowadays)
What I liked though is that it didnt have the empty statement ';' so you really had to understand the semantics. Sometimes you were not allowed to end you statements with ';' (since they were ended by the block, so this would require the emptystatement). I think freepascal does not have this feature anymore (which is the thinking changing).
And just one more thing: Personally I would try to learn ADA before diving into Pascal.
What is a good beginners guide to Free Pascal? I see the user's and programmer's guides, but those are only useful once you know the syntax and so forth.
[+] [-] bloblaw|5 years ago|reply
...and you'll be up and running with (1) FreePascal compiler (2) Lazarus IDE (https://lazarus-ide.org) with integrated debugger and RAD (Rapid Application Development) GUI designer.
Lazarus and FPC can create high-quality native GUI's for macOS, Linux, and Windows. And many open-source 3rd party GUI components can be installed right from within the Lazarus IDE via the "Package" > "Online Package Manager" menu option.
I've been using Delphi and/or Lazarus + FPC for 15 years. It's truly the most productive way to build a GUI desktop application, and makes it extremely easy to build powerful console apps.
[+] [-] fmntf|5 years ago|reply
[+] [-] pjmlp|5 years ago|reply
We had to wait until Windows 8 to properly get it, and still its being rebooted due to the way WinRT went, whereas it could bave been there since v1.0.
https://github.com/dotnet/designs/blob/main/accepted/2020/fo...
[+] [-] ubercow13|5 years ago|reply
[+] [-] WalterGR|5 years ago|reply
How does the experience compare to C#, .NET Core, and Visual Studio?
[+] [-] 0x445442|5 years ago|reply
[+] [-] Sunspark|5 years ago|reply
"Bill Gates saw the success of Turbo Pascal "in very personal terms, and 'couldn't understand why [Microsoft's] stuff was so slow. He would bring in Greg Whitten [programming director of Microsoft languages] and yell at him for half an hour.' He couldn't understand why Kahn had been able to beat an established competitor like Microsoft.""
[+] [-] bluedino|5 years ago|reply
[+] [-] mikewarot|5 years ago|reply
[Edit] One of the nice things about pascal strings, and variable parameters, is that you can write functions like
getinteger(var s : string):integer;
Which literally pulls a sign plus digits from s, skipping spaces, until it hits a space, comma, etc... s gets shorter, you get the integer, and it just works.
I don't think that type of thing is even possible in C because of null terminated unmanaged strings.
[+] [-] benibela|5 years ago|reply
Should be like, getinteger(const s : string; var startPos: sizeint):integer;
Pascal always has the best possible ideas, and then fucks up the implementation.
[+] [-] hiker|5 years ago|reply
[+] [-] rzzzt|5 years ago|reply
Then the pointed-at pointer can be manipulated within the method body and changes will be visible on the outside as well, giving you both the numeric return value as well as the shortened string as the output. This is what the second argument of the strto{d,f,ld} function does: https://devdocs.io/c/string/byte/strtof
[+] [-] benibela|5 years ago|reply
Would have been a better title
Sure, that happened months ago, but there was no announcement thread on HN. It is sad. So many programming languages get an announcement thread, but FPC is forgotten all the time.
edit: actually there was such a thread. I just missed it. But it had no comments
[+] [-] fayten|5 years ago|reply
Both advertise fast compilation, and they do compile quickly, but my experience with even 5-10k loc projects with those languages start to see some time sunk into the linker, even with Gold. This will inevitably lead to the change-execute cycle taking 1-3 seconds, while I have had no issue with substantially larger fpc code bases compiling and running in milliseconds.
For Rust and C++ devs a change-execute cycle sub 10 seconds is incredibly enticing. However, fpc has ruined me for what fast compilation really means. It also makes me really wish Nim had stuck to fpc as a backend.
I know very little about what is actually going on behind the scenes here. If anyone has any info about pascals compilation as well as linkers in general I would love to know more.
[+] [-] fayten|5 years ago|reply
I checked HN and it looks like there is an old discussion here: https://news.ycombinator.com/item?id=9597406
So, I'll probably give this a read when I find time. Hopefully someone else will find it useful as well.
[+] [-] pjmlp|5 years ago|reply
Turbo Pascal has spoiled me in 1990's hardware.
[+] [-] thijsvandien|5 years ago|reply
[+] [-] tekknolagi|5 years ago|reply
[+] [-] Sunspark|5 years ago|reply
It's a real language. Skype for Windows was originally written in the Delphi dialect.
[+] [-] snarfy|5 years ago|reply
[+] [-] davidhbolton|5 years ago|reply
There are some of us who still work in Delphi. (Yes I know its not Freepascal)
[+] [-] codr7|5 years ago|reply
I spent 13 years developing and maintaining that system, around 2-3 MLOC at the time I left.
I found Delphi awesome in many ways but too enterprisey and too far removed from reality in others. Every few years a new technology would appear to replace the previous half baked attempt at solving the same problem, or dropped completely and replaced by third party components. Long term I found the software very frustrating to work with since everything about it was so volatile and there were so many random gaps in quality and functionality.
Their database, Interbase, was pretty good; and well integrated into the language/IDE. Open sourced and forked as Firebird SQL at one point.
[+] [-] pjmlp|5 years ago|reply
Also here in Germany there is still a big enough community to warrant having Delphi conferences and articles in all major magazines that are language neutral, like Windows Developer one.
[+] [-] michaelcampbell|5 years ago|reply
[+] [-] wila|5 years ago|reply
For Delphi, maybe somewhere next year. They did put it on the road map, but there are no guarantees [2].
[1] https://forum.lazarus.freepascal.org/index.php/topic,52127.0...
[2] https://blogs.embarcadero.com/rad-studio-roadmap-november-20...
[+] [-] cnasc|5 years ago|reply
From the perspective of the Alan Perlis quote “A language that doesn’t affect the way you think about programming is not worth knowing,” is it worth it for me to give FreePascal a try? Or if I have experience in other procedural languages have I pretty much seen what it has to offer already?
[+] [-] zyxzevn|5 years ago|reply
The string handling are much better than C. Most is just automatically. You would not even encounter any difficulties until you start to interface with C libraries. And then it is still easy.
Due to this and strong typing and bounds-checking you automatically avoid most memory errors that you get in C. But you can make it as complicated as C, with pointers to pointers to arrays, disable bounds-checking/type-checking, etc. There are some limited parametric type possibilities.
The disadvantage is the absence of closures/lambdas. Instead you have to make pointers to functions, like in C. Or use Objects like in Java. But with manual memory management.
The manual memory management and type declarations give extra overhead. Like in C. A lot would be avoided with inline variable declarations with automatic typing.
[+] [-] TurboHaskal|5 years ago|reply
I would say Pascal's killer app today is Lazarus. An open source, multi platform GUI RAD IDE.
https://www.lazarus-ide.org
[+] [-] megameter|5 years ago|reply
The syntax will be the primary barrier. Things like nested if-else with multiple conditionals are just a little more persnickity if you've been using C braces for decades. But the language, in the Borland dialects that most are using now, is somewhere in between C and C++ in terms of power overall: it's a little safer by default, still manual memory, but without needing to fling around quite so many pointers. And those compile times! A pretty well-suited language for game coding, actually.
And in terms of writing production code, libraries may or may not be a barrier. Basically, Pascal's current ecosystem exists in the shadow of one of the best RAD environments of the 90's - Delphi. That's where a lot of the code got written, and there's a definite focus on native desktop apps that remains. There are certainly good libraries available, but many are old, Delphi-centric, and lack polish - haphazard accumulations from developers that are very "get-er-done" and unconcerned about reuse. You can always bind C code, of course, but today it's easy to end up saying, "well, but I could just get a working library in (Go/Python/Node/etc) and be done" and thus end your Pascal journey before it starts.
[+] [-] tangentstorm|5 years ago|reply
The way primitive sets and enumerated types fit together is still a rarity, as far as I know. (You can accomplish the same things in any low-level language, but the pascal syntax make it really nice.)
Interfaces in pascal are fairly interesting because they allow you to implement your own addref/decref routines for automatic reference counting. This was made for COM, but you can plug it into whatever reference counting scheme you like (say if you want to write python extensions or whatever).
The main thing is still probably the component system though, and the tight integration with the development environment.
It's kind of a trip the first time you configure an IDE plugin and realize it just recompiled the whole IDE for you.
[+] [-] idiocrat|5 years ago|reply
[+] [-] andi999|5 years ago|reply
Also what I really hate about Pascal is it is dishonest. It tells you it is very structured and your code will be better because of limited expressiveness. But then the 'writeln' 'function' needs to be intruduced at the compiler level - you cannot write such a function in the Pascal grammar. (maybe with freepascal you can nowadays)
What I liked though is that it didnt have the empty statement ';' so you really had to understand the semantics. Sometimes you were not allowed to end you statements with ';' (since they were ended by the block, so this would require the emptystatement). I think freepascal does not have this feature anymore (which is the thinking changing).
And just one more thing: Personally I would try to learn ADA before diving into Pascal.
[+] [-] pjmlp|5 years ago|reply
Does anyone know about the state of WebAssembly support?
[+] [-] pmeira|5 years ago|reply
[+] [-] Wowfunhappy|5 years ago|reply
[+] [-] jonsen|5 years ago|reply
[+] [-] the_only_law|5 years ago|reply
[+] [-] doener|5 years ago|reply
[+] [-] 7thaccount|5 years ago|reply
[+] [-] benibela|5 years ago|reply
Or this with Delphi syntax for generics: http://newpascal.org/assets/modern_pascal_introduction.html
[+] [-] sgt|5 years ago|reply
[+] [-] pjmlp|5 years ago|reply
Now with creekshaw being integrated we might be reaching there though.
[+] [-] ac42|5 years ago|reply
[+] [-] hu3|5 years ago|reply