Lazarus 1.8 released: cross-platform GUI builder and IDE for Pascal
forum.lazarus.freepascal.org
forum.lazarus.freepascal.org
If you like FreePascal and are not yet familiar with http://nim-lang.org , check it out - it is inspired by Pascal and Python, compiles quickly to standalone binaries (like free pascal) or JavaScript, or C, or C++ or Objective C.
But it doesn't have anything resembling Lazarus .... I wish it did.
TBH there isn't really a killer feature in Free Pascal, something that you can point to at the language and say "this, this is why i am using it". Almost everything it has you can find in other languages.
The main and biggest reason -IMO- to use Free Pascal is Lazarus. Personally i use Lazarus a lot and i don't really care much about the language - i come for the framework and the IDE, the language is secondary and i don't care if it is Free Pascal, D, Go, C or some custom one (as long as - like FP - i can create standalone programs). Of course it doesn't hurt that the language is pretty decent.
Often people choose an IDE based on the language they want to use, but i think in this case is the reverse: Lazarus is a reason to use Free Pascal, not the other way around :-P.
There was a reason that Visual Basic was so popular -- and that was not because BASIC was a great language. Instead it had a great GUI editor and you could very quickly create your apps by dragging and dropping the components and adding code for the actions! For me, Lazarus is the VB of today.
- fast to run (and compile)
- native and cross-platform from a single code base
- memory-efficient to run (depends on your code of course)
- easy to distribute via a single self-contained exe file with no dependencies
You might think lots of popular languages today can do all the above, but surprisingly there are fewer than you think.
For example, using a dynamic language to create desktop apps will often require gluing together lots of separate libraries and packaging them into a single bundle using another third-party tool. And that's even before you get to speed of execution and responsiveness (yes, performance does matter).
Like other posters have said, Pascal doesn't give you features you won't find in other languages, although if you're coming from a dynamic language, Pascal might make you think a little differently about how you solve problems due to its strong and strict typing features.
[0]: https://www.freepascal.org/docs-html/prog/progsu147.html [1]: http://wiki.freepascal.org/Creating_bindings_for_C_libraries
The modern Pascal is not the same old language as in Borland's Turbo Pascal from the 80s, it's developing, it even has generics - see the "Modern Pascal Introduction" article[0] by Michalis Kamburelis.
Also, quickly (or rather rapidly, as in "RAD") creating truly native and cross-platform GUI applications using Lazarus IDE is the killer feature for me.
[0] - http://castle-engine.io/modern_pascal_introduction.html
OTOH, it's not the same, much as modern C isn't the same as K&R C.
First of all, you'd need to somehow make the Free Pascal and whatever C++ you choose to talk to each other, the C++ compiler to be able to instantiate Free Pascal classes (so you can use LCL) and the Free Pascal linker (in the platforms where it is used) to be able to link against C++ objects. Also it would need the C++ compiler to take into account the minute details of Free Pascal's semantics (e.g. in C/C++ it is undefined behavior to dereference a NULL object, but in Free Pascal it is perfectly valid - it'll just do whatever the underlying system does when someone tries to access memory at address 0 - so the C/C++ compiler should not assume that never happens).
This is the hardest part, but the second hardest part isn't that easy either: you'd also need to extend CodeTools (the framework that Lazarus uses to parse and maintain an in-memory view of the source code you are editing, the units it uses and their structure and basically keep a somewhat mirrored - but mutable - view of what the compiler would see, plus the extra stuff an IDE needs like the ability to perform queries to find symbols, declarations, etc and manipulations for refactoring) to understand and work with C++ code, so that IDE functionality for updating the code when you modify a form, create an event handler, syntax and word completion, code completion (e.g. declaring a property and automatically creating the backing field and setter method or implementing abstract/virtual methods from a superclass - that in this case might be in Free Pascal instead of C++), etc will work.
Note that Embarcadero (who develop Delphi and C++ Builder) did the compiler part of the above using Clang for their C++ Builder, but since Clang doesn't require sharing the changes, that effort was basically lost (only usable by those who are still stuck using Embarcadero products, until the project inevitably dies as C++ Builder was far less popular than Delphi), so anyone who wouldn't like to do something similar with Lazarus would have to start from scratch - an unnecessary waste of time thanks to Clang choosing a permissive license.
In practice however i do not think this will happen because it'll need coordination between several teams - and each team to care about the others. For example, Embarcadero who did that with Clang are now stuck with an ancient version of it because of their modification. For it to be done right, it would need the Free Pascal developers to cooperate with the Clang developers to not break each others' code and for the Clang developers to accept the extensions the Free Pascal developers introduce to support the extra functionality that interfacing with Free Pascal needs.
Perhaps you meant to say "Eiffel"? :-)
YMMV.
It just felt natural to use both languages.
C++ was the welcoming home that we never taken C for, thanks to offering language features that we could use to for safer applications, and more developer friendly abstractions.
However i think it might be a better idea to just use a plain old C interface (c2pas can help to automate this if you want to create a hybrid C and Free Pascal project).
It is the official way of exposing OO ABIs on Windows, and for WinRT (UWP) it was improved to support generics a la .NET.
edit: words