11 ms·
Free Pascal
- Wowfunhappy 6y agoThe set of supported platforms and operating systems is nuts!
- doener 6y agoEven Nintendo Wii. ;)
- jonsen 6y agoWould be interesting to know the total number of active users out there.
- jksmith 6y agoI'm writing a major system using FPC/Lazarus right now, and will fund additional dev as soon I can get a reference mvp done. No idea how many people are using this toolchain to produce real work, but I consider it to be my secret weapon. I've never seen a truly multi-platform, batteries-included dev tool that is so coherent and comprehensive. At this point, the only add I would love to see is better macro expansion beyond the simple code macros that are provided now. At any rate, depending on your definition of success, if you want to see an example of a decades old, open source project that really does work, throw the FPC/Lazarus project in with Linux itself. I'll spend the day today writing code on both a Windows and a Linux machine for the same project, producing the same ui heavy app with hardly any differences, thanks to this toolchain that runs pretty much exactly the same in either environment. Seeing the love and dedication put into this project by contributors is a great way to remember how cool writing software really is. All devs should at least fiddle around with FPC/Lazarus just so they know what it is.
- martinrame 6y agoFor me FPC/Lazarus are also a secret weapon. We use them at my company in production apps (mostly web and commnand line programs) since ages.
- the_only_law 6y agoiirc they still have an 8086 compiler.
- michaelcampbell 6y agoI 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.
- sgt 6y agoWhy doesn't Rust adopt a running cheetah or similar to show that it is just as fast as Free Pascal?
- cnasc 6y agoI’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?
- andi999 6y agoIf 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.
- memsom 6y agoNo, sets. Sets are amazing. I still miss them to this day. Pascal also had sub ranges long before C# and the type system was very good. Delphi dereferenced its object model be default, so you could use dots rather than the awkward ^. Of pascal (-> in c++ and C)
- JoeAltmaier 6y agoImplementations sucked. They were bit vectors, limited to one machine word in length. So they were 16, 32 or 64 limited depending on where your program ran.
- davidhbolton 6y agoIt 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)
- pjmlp 6y agoI 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.
- codr7 6y agoMost 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.
- pjmlp 6y agoLove the effort being put into Free Pascal. Does anyone know about the state of WebAssembly support?
- pmeira 6y agoI was just looking into that and couldn't find much besides this: https://twitter.com/lIlIIllIIllIlll/status/1316014058739388417 https://twitter.com/lIlIIllIIllIlll/status/13160140587393884...
- mikewarot 6y agoI'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 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.
- rzzzt 6y agoFor "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 https://devdocs.io/c/string/byte/strtof
- mikewarot 6y agoI appreciate that in C pointers are the coin of the realm, I really do appreciate not having to deal all the time, stuff just works. [Edit] For example, you can also insert into a string, making it longer, without having to worry about it.
- benibela 6y agoHowever, such pointers are unsafe, since someone could pass an invalid or null pointer var/out variables are much safer, since the variable exists at the calling site , is valid and not null. It is also much safer than C++'s & references. It is very subtle, but rather amazing if you think about it. Because C++ can return a & reference, it can return a reference to a value on the stack frame of the callee, which then becomes invalid. But the var/out variable always exists on caller's site, so it is always safe. (at least if it a reference to the stack. a reference to the heap could be freed indirectly through another reference. )
- bloblaw 6y agoFor 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 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.
- pjmlp 6y agoA 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. https://github.com/dotnet/designs/blob/main/accepted/2020/form-factors.md#native-aot-form-factors https://github.com/dotnet/designs/blob/main/accepted/2020/fo...
- fmntf 6y agoSometimes 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?
- bloblaw 6y agoThis was written a few years ago with FPC v2.2 (latest is FPC v3.2), but generally matches my experience: https://wiki.freepascal.org/Size_Matters#Analysis_of_various_options https://wiki.freepascal.org/Size_Matters#Analysis_of_various... tl;dr is that if you create a RELEASE build, should be about 2 - 5mb for a GUI app, depending on the platform. And if you run `upx` against the resulting binary, it will be even smaller. Win 7 x64: ------------ - 12.3 mb == Default build - 3.2 mb == Default build without debug info - 2.1 mb == Optimized compiler - 2.1 mb == Optimized compiler without debug info Ubuntu x64: ------------ - 13.4 mb == Default build - 7.5 mb == Default build without debug info - 4.4 mb == Optimized compiler - 2.7 mb == Optimized compiler without debug info Optimized compiler means: 1. Project|Compiler Options|Code|Smart Linkable (-CX) -> Checked 2. Project|Compiler Options|Linking|Debugging| Uncheck all except `Strip Symbols From Executable (-Xs) -> Checked`Strip Symbols From Executable (-Xs) -> Checked 3. Project|Compiler Options|Linking|Link Style|Link Smart (-XX) -> Checked 4. (Optional) Project|Compiler Options|Code|Optimizations|smaller rather than faster -> Checked (Warning: this might decrease performance)
- Sunspark 6y agoI 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.
- snarfy 6y agoIf 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.
- bloblaw 6y agoAgree++ The "WMI Delphi Code Creator" (written in Delphi) is a great example of this. "The WMI Delphi Code Creator (WDCC), allows you to generate Object Pascal, Oxygene, C++ and C# code to access the WMI (Windows Management Instrumentation) classes, events and methods. Also includes a set of tools to explorer and Query the content of the WMI." Note that Object Pascal == Delphi == FreePascal (generally) https://github.com/RRUZ/wmi-delphi-code-creator https://github.com/RRUZ/wmi-delphi-code-creator
- pjmlp 6y agoAlso a note that the original Object Pascal was created for Mac OS, before Borland took up the term and Apple's extensions.
- Sunspark 6y agoSaw this quote in Wikipedia, I find it amusing: "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 6y agoI 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.
- fayten 6y agoSomething 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.
- thijsvandien 6y agoIt'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.
- fayten 6y agoI'm not sure if it's good form to reply to yourself here, but I did find this: https://lwn.net/Articles/276782/ https://lwn.net/Articles/276782/. It appears to be a 20 part series from a(the?) Gold developer on Linkers. I checked HN and it looks like there is an old discussion here: https://news.ycombinator.com/item?id=9597406 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.
- cb321 6y agoCompiling an echo "hello world" module in Nim from scratch to a fully linked executable can be under 200 milliseconds on modern hardware with the TinyC/tcc backend. tcc has its own assembler and ELF linker built in to get that speed. I don't know much about fpc/free Pascal, but maybe it also does very little optimization of generated code and has its own assembler/linker. It think these are the Big Three things for a fast compile. To get a fast edit/compile/test workflow I just set up my default backend to be tcc and automatically switch to gcc if "-d:release" or "-d:danger" is given on the compile line { really I abbreviate that to "-d:r" :-) } This makes it easy to develop quickly and then switch right over to quick timing tests. Nim also has an interpreter whose startup is more like 100 ms, but which is limited to only what its virtual machine target (also used for compile-time computation) supports.
- benibela 6y agoFreePascal 3.2 released! 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
- wila 6y agoOne of the cool things about FP is that it already runs on the apple M1 under Big Sur [1], although of course it is a work in progress. 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.html https://forum.lazarus.freepascal.org/index.php/topic,52127.0... [2] https://blogs.embarcadero.com/rad-studio-roadmap-november-2020/ https://blogs.embarcadero.com/rad-studio-roadmap-november-20...
- 7thaccount 6y agoWhat 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.
- benibela 6y agoPerhaps this one: https://castle-engine.io/modern_pascal_introduction.html https://castle-engine.io/modern_pascal_introduction.html Or this with Delphi syntax for generics: http://newpascal.org/assets/modern_pascal_introduction.html http://newpascal.org/assets/modern_pascal_introduction.html
- 7thaccount 6y agoNice. Thanks!