Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Lazarus 1.8 released: cross-platform GUI builder and IDE for Pascal (freepascal.org)
125 points by open-source-ux on Dec 10, 2017 | hide | past | favorite | 35 comments


FreePascal is awesome, Lazarus is too.

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.


It’s not the same, and it’s not there yet, but perhaps eventually something could be built from nimx or similar.

https://github.com/yglukhov/nimx


I have written a lot of FreePascal in Emacs, because for the things I want to do in Pascal, Lazarus isn't much help. Lately, I've been revisiting Nim, and the experience is similar in a very good way.


Why would one choose Pascal as a basis for a new development ? I ask the question in a fair way and as someone who has written a lot of code in TurboPascal ages ago (and enjoyed it enormously). I wonder what it feels to develop production code with Pascal compared to say Java or Python. From those days, I remember the speed of the compiler (but my projects were not big) and the clean language.


Generally, you get to use a high level object oriented language that feature-wise is somewhere between C++ and C#, but with a much faster compiler and without any sort of runtime requirements (compared to C#). Free Pascal creates standalone executables that can be as small as 40KB, which is something you mainly see with C and C++ compilers these days (and languages that "compile" to C).

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.


Because lazarus (and its commercial alternative Delphi) are excellent tools and probably the best way to actually develop GUI applications right now (see the related discussion here https://news.ycombinator.com/item?id=12350834 and especiall the great comment from TimJYoung).

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.


Lazarus + FreePascal is an excellent choice if you want to create desktop GUI apps that are:

- 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.


How is FreePascal's interop story? It would be super interesting if you could use Lazarus to build the GUI around a library written in a language with a larger ecosystem and/or with more powerful safety features.


You can link to anything with a C ABI just by declaring the functions external[0], there's also tools for automating conversion from C header file declarations[1].

[0]: https://www.freepascal.org/docs-html/prog/progsu147.html [1]: http://wiki.freepascal.org/Creating_bindings_for_C_libraries


I like Pascal for its simplicity and clean syntax.

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


Turbo Pascal in the early 90's was already quite modern, to the point C felt dated versus Turbo Pascal 6.0. :)


It's not much about choosing Pascal as a language but rather Lazarus as a RAD system. Pascal is still a powerful and easy to learn language, but the strong point here is the Delphi/Lazarus approach to rapid development. I wish other languages too could be integrated with it.


If you're writing commercial windows app installers, the default way to do so is with Inno Setup, in Pascal.


It is still an amazing tool if you want to build classic desktop applications or games. Blazingly fast, easy to use. Not fancy in the Visual Studio/Jetbrains way, but it always feels rock solid to work with.


Is becoming my new tool of choice, just keeps getting better and better, keep up the good work chaps..


From the documentation, looks like TP 5 from my high school days :-)


Modern Object Pascal is a linear descendant of Turbo Pascal, so the resemblance isn't coincidental.

OTOH, it's not the same, much as modern C isn't the same as K&R C.


What it would take to add C++ support?


A lot of work.

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.


I highly doubt anybody seeking out to create and use an Object Pascal development environment wants anything to do with C++.

Perhaps you meant to say "Eiffel"? :-)

YMMV.


It would be useful to create tools for existing codebases. For example ~10 years ago when i worked at a game company, we were considering C++ Builder to create the tools for the engine because we could use the engine libraries directly (the engine was really a collection of many small libraries). However that idea was abandoned because C++ Builder at the time had very bad support for C++ (a few years ago they switched to Clang and modified it to use their C++ extensions, but that was too little too late - and AFAIK it wasn't 100% compatible with the previous compiler).


Actually many C++ devs are ex-Turbo Pascal, Delphi and C++ Builder users.

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.


You mean LoadLibrary and GetProcAddress?


That works only with functions. With objects it gets trickier.


You mean COM and IUnknown?


If you are fine with COM and staying with Windows only, Free Pascal has native support for COM interfaces and Lazarus can generate wrapper units for ActiveX controls so that you can use them in a form like anything else.

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).


I'm guessing HN is too young for CORBA


I remember it but not very fondly....


I really miss those millenial usenet discussions about whether if you should be trying to send large amounts of data over flaky 56kbps connections (at best) via TCP instead of using CORBA2 because it was slow and required code to adapt existing systems. Delphi already had remote objects, data providers (served via SOAP) and database connections and they actually worked well. In the meantime, microsoft and yahoo invented their own binary chat protocols which worked reliably and scaled to hundreds of thousands of users and everyone was jealous.


The top comment was about C++ support. With LoadLibrary you can easily interface with C functions but not with C++ classes. That's why a lot of C++ code still exposes a C interface if it's used from another language. COM works too but that adds other problems.


COM has been the future of Windows APIs since Vista, re-inforced with UWP.

It is the official way of exposing OO ABIs on Windows, and for WinRT (UWP) it was improved to support generics a la .NET.


Yes, Lazarus is good. Here is a screenshot of a digital clock app that I created using Lazarus and FreePascal, on Windows. I use it on a daily basis on my PC. Just need to Alt-Tab to it or click on its icon in my taskbar,, to check the current time, on my laptop. Bigger font than the time in the system tray, so easier to read at a glance.

https://imagebin.ca/v/3kMOLN2Ru4gc


No export to HTML5 support?


No, but if you separate the logic from the presentation you can use the LazWeb (or FclWeb, i don't remember) components to create a web-based frontend for the application. There is also a separate framework called Brooks that is supposedly more comprehensive, but i haven't tried that (and TBH i have only touched LazWeb/FclWeb only a little).


You might find https://smartmobilestudio.com/ interesting to quickly develop webapplications using what you learned in Pascal/Delphi. It compiles Pascal to Javascript and supports HTML5 canvas etc.

edit: words




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: