I'm no expert, and Pascal is kind of a weird language by modern standards, but Lazarus does cross-platform desktop development using GTK or QT bindings.
Personally I like that it gets and stays out of my way. The UI design copies Visual Basic almost to a T and is a little dated by today's standards, but all the important bits are there.
LOL. Delphi ran circle around VB. It could do what VB did but way better and could also do what MS C++ did. Obviously as you admit you have no real knowledge of the subject.
Wow, could you be any more haughty? I'm referring specifically to the UI. Yes I never worked with Delphi so I am indeed quite ignorant to its obviously apparent wonder.
Delphi's precursors were Pascal as a language and ObjectVision as the concept of the UI (released in 1991). Both products created by Borland. It did not need VB to "copy from". Borland tools of the time were superior to MS and drove Gates nuts.
Pascal in Delphi / Lazarus in its current form is a full featured language that implements large amount of common concepts expected from a modern language. I do not see anything weird in it.
They always implement some language feature, but then put some weird, arbitrary restriction on it. It is twice as weird in FreePascal, because the developers cannot decide if they want to make their own language or be Delphi compatible.
Some weirdness examples:
There is automated reference counting to get memory safety, but only for strings and arrays (and also interfaces but we get to that later)
There is mutability xor aliasing, but only for strings
There is a type to store sets of integers, but you cannot have more than 256 elements
There is a type to store a slice of an array, but it can only be used during function calls, so no one ever uses it. Also it looks like it cannot be used with a slice of length 0, unless it is a slice of an array of length 0.
Interfaces are a very common concept in OOP languages. They specify some methods, but not their implementation. Everyone here knows how they work and in Pascal they work in the same way. Except, in Pascal they are also COM interfaces and add automated reference counting to a class. It is weird in the reverse, too. You can have classes with ARC which are almost memory safe, but only if you use an interface.
Array indices start with 0, string indices start with 1. It is already weird, but you can get used to it. But now they added OOP like string functions and it became weirder. Copy(Str, ...) becomes Str.Copy(..). And all the new methods use 0-based indices for strings.
Every language has various peculiarities / weirdness, tons of it actually. If you use multiple languages you just get used to this. That is my case and I do not consider it weird. If you stick to 1 or 2 languages than sure - everything else seems weird.
>"they added OOP like string functions" - not sure / forgot what is official name for it but it is not unique to pascal.
Again we have totally different perspective on weirdness.
My career took me to C-like languages and scripting environments like Ruby or Python. And (love it or hate it) most of the world thinks in JS nowadays. Some aspects of Pascal are really strange or awkward to me, like the rules for whether or not a statement in an `if` block needs to be surrounded by `begin`/`end`, or where the semicolons go in a particularly complicated, nested instance of said `if`.
But I am not a master Pascal programmer by any means. You sound like an expert.
I think in terms of fair amount of languages (including JS) so I do not get hung up on any particular one. My business is product development from scratch. I do it for clients or my own company. Because of that I could not care less about what "most of the world" prefers. I use what I think is most suitable given constraints for each particular project.
I don't think so - his focus was always on making compilation fast and the language simpler and easier. See Oberon (the latest language he created) - it's probably even simpler than Ruby or Python.
Pascal might not be weird but it is unpleasant. It has many inconveniences to offer the modern programmer. In its day, in comparison to C -- by programmers for programmers -- Pascal was derided by one computer scientist as "a police-state language" for its many strictures and missing affordances.
Pascal is designed to be safe, like Rust is. Pascal was missing some things needed for systems programming but those were added in Pascal's sequel, Modula-2, whose sequel, Oberon, ended up being a very nice language.
It's too bad Modula-2 didn't come along earlier to compete with C. We could have avoided most of the security problems with C and C++ programs.
Instead, here we are, 50 years later, finally moving toward safe languages again. Took long enough.
Some people loved it, some hated it. Some (this includes me) used it where it did offer advantage. I do not use Pascal to write servers (even though I could and did for some particular situations). I use maily C++ for it. But for developing lean and mean desktop GUI apps for multiple platform I find nothing better. Also I am not sure what pascal are you talking about. The one "derided by comp scientists" and current Delphi/FreePascal are one universe apart.
Confession. Learnt Pascal at Uni. Programmed in Compas Pascal 1984 (precursor to Turbo Pascal) then Turbo Pascal 3.0 from 1986-1993. Then from 1997 to the present day worked with Delphi (2,3,4,5,7, XE7 and XE 10.1). I wrote a 40,000 line Postal Game in 1989-1990 in TP 5.0 that still runs today.
Original Pascal was dire at anything except learning Pascal. Strings were type alfa- 10 character strings. Turbo Pascal was the first decent implementation and whipped the pants off its rival UCSD-Pascal. Delphi has been dead though since about 2000 but there's a lot of legacy code around and I'm one of a team of four that look after (maintain and enhance) a 1.35 million Lines of code property management application. A business laptop from 2020 can compile all 1.35 millions lines in around 11 seconds.
Unless you were an ace C++ Windows developer, Delphi was the next best programming language for using the Win32 API and doing low level COM stuff.
It is and it is not. It is used in many industrial companies for example to write windows based desktop applications. I have couple of my own Windows based products that bring some money. Even though those are about 10 years old I keep them up to date with all new technologies that make sense and port to every new version of Delphi. This is actually very easy and does not require much time. There is also more than enough libraries and components to do just about anything. FFS I do interrupt based device control with the rate of 256 requests / s over USB.
Still for servers / NO GUI I very much prefer C++.
Highly invested in Electron, but I love Lazarus. I find it unmatched in what means developing cross-platform native apps, I only wish more people would know about it and use it, popularize, make noise, contribute.
The maintainers are absolutely awesome guys, the helpful and kind type.
> Lazarus does cross-platform desktop development using GTK or QT bindings
Not just GTK (mostly for Linux) or QT (for any) but Win32 (for Windows) and Carbon / Cocoa (for macOS) - so it can produce native GUI. This means smaller codebase and much better user experience.
I have used it for many years. For me it's still the only IDE with a fast compiler that creates native applications for Linux and Windows (and many other OS). And it doesn't require additional runtime libraries to be installed, so just download and run the application.
BTW: I created a Personal Kanban Task Organizer that is automatically built for Linux and Windows. It uses lazbuild in a GitLab CI Docker Container:
I am still salty that it took 20 years for .NET to achieve a similar native experience, and lets see if they don't bork it, like the previous features.
A couple weeks ago I sat down with this and tried to build a simple client for an HTTP API. Three hours later, having read about all sorts of prebuilt proprietary components without being able to try writing any code at all I gave up. Can anyone point me towards a library that will help me make somewhat-complex HTTP Requests on this platform? Something more than GET, that allows me to set headers?
Those days I'm using libcurl with the bindings that are supplied with Lazarus/FPC... works perfectly fine (tested on Windows and Linux, I suppose MacOS will work too... on Windows you need to install the DLL, e.g. libcurl-x64.dll). No need to install anything on Lazarus/FPC. Below a basic (incomplete) example of a GET request with a custom header, but as this is just a binding to libcurl, it basically allows you to do anything, including other protocols (libcurl can even have SMTP support, depending how it is compiled).
uses libcurl;
function curl_callback(data: pointer; size: size_t; nmemb: size_t; str: PStream): size_t; cdecl;
begin
// do something with incoming data
end;
var http: pCurl;
hdr: Pcurl_slist;
begin
http := curl_easy_init();
// [...]
hdr := curl_slist_append(NIL, pchar('Authorization: Bearer ' + EncodeStringBase64(AUTH_TOKEN)));
curl_easy_setopt(http, CURLOPT_HTTPHEADER, [hdr]);
curl_easy_setopt(http, CURLOPT_WRITEFUNCTION, [@curl_callback]);
curl_easy_setopt(http, CURLOPT_URL, [pchar(API_URL)]);
// [...]
if (curl_easy_perform(http) <> CURLE_OK) then begin
// [...]
end;
end.
I had the very same experience, and ended up using the wikipage posted above. But I had to fix it because there were some outdated information.
It's not that Lazarus lacks features, the problem is that the documentation is lacking and scattered. I found that the best way to learn Lazarus is to refer to some good Delphi books, provided that they are not too recent. (The Internet Archive has a few.)
I use the synopse mORMot library for server side rendering http server and database access. It has well written documentation with lots of examples on how to get started. IF you have any questions I am free to answer them.
It just seems very odd that (2!) people would recommend an "ORM/SOA framework" when all the poster wanted was an HTTP client library. At least you can link to the HTTP client parts?
It is because Lazarus/FPC have no package manager to handle dependencies. It is crippling the ecosystem.
If you want to write an oss ORM/SOA framework with HTTP, you cannot use a HTTP client library, because then people cannot compile your framework when they do not have the library installed. You can write in the documentation, they should install the library, but no one reads that. Also, if the library gets an update, it might not be compatible anymore.
So you need to bundle the HTTP client in your framework. Now you could write your own or fork one, but in either case you end up with a framework and its own HTTP client.
I'm a fan of Wirth languages in general and had the pleasure of writing DOS applications in Topspeed Module-2 in the late 90s. I generally find the Pascal/Modula/Oberon languages fit my cognitive abilities well. Perhaps it's because of the need to plan out definition and implementation separately as well as use of units/modules - I don't really know tbh, but it just feels ok to me.
I've dipped in and out of FPC/Lazarus over the years, and will give this a re-look, especially now I'm inspired by some of the comments in this post.
Apologies if this is not allowed on HN, but there is Topspeed Modula-2 at this link. I think it's fully abandoned, but I'm still a bit uncomfortable with the ethics of sites like this.
Please - usual security caveats apply of course. I have not installed this myself to check out for malware. It is my intention to try and install it under FreeDOS on an old, air gapped, laptop at some point. Bring back some memories!
Lazarus is great! While FPC and Lazarus make it very easy and productive to make cross-platform GUI software, people should know that mORMot (https://github.com/synopse/mORMot2) makes it very easy to develop cross-platform web apps.
mORMot has been around for over a decade, the feature-set is very rich and mature, and the development and user forums are also very active - you can easily confirm that by checking the github repo's commit logs and visiting their forum.
mORMot's ORM is quite interesting - it's based on SQLite and supports all other mainstream databases through SQLite's virtual table mechanism.
> Would love to see a page with currently in production software written in Pascal.
Not sure about a page with a list, but I know that Altium Designer (one of the big commercial electronic design automation platforms) is at least partially written in Delphi. The executable of one of the last versions contains this string: "Embarcadero Delphi for Win64 compiler version 30.0 (23.0.21418.4207)". The platform even uses a Pascal-based scripting language named DelphiScript...
Original standard pascal was shitty. Strings had a strongly typed length, so you couldnt write a function which accepts strings of different length. Also (what I personally really dislike) the syntax doesnt allow you to write your own 'write' function (since lets call it variadic parameters were not allowed).
Turbo Pascal was better and Delphi pascal was great.
Pascal was the first programming language I had contact with, in high school. I have fond memories of it. Recently I looked into the status of current software written in Pascal. One thing I noted is few of them are packaged in Linux repositories. Wonder what causes that. Is it harder to package Pascal software for Linux, when compared to the average C package?
Pascal programs are much easier to package, since the usual Pascal libraries are linked statically. You get a standalone binary, you can distribute.
I have tried to submit some of my Pascal programs to the repositories, but nothing happens. You cannot pack it yourself, but need to get support from a distribution maintainer. They try to compile it, discover that they do not have a Pascal compiler installed, and give up on it
As of my last look a couple of months back, the extensions for Pascal in Code weren’t particularly usable. Omni Pascal may get there. There’s a language server in development but I don’t know anything about it.
My pet peeve with Lazarus, Deplhi and other visual RAD tools is lack of reusability and composability.
The built-in visual blocks are great, but building your own is nontrivial, you can not build them visually, you must code. To add insult to injury, in Delphi custom components were system-wide, not project scoped and required elaborate installation/registration to show up in the IDE.
Also pascal is insanely verbose, i.e. simple list operations (like building list of options for selecbox) span multiple lines of code.
I'd like to see a RAD tool with so good component design as Lazarus (the Delphi component model design is great and provides for fast, memory efficie t implementation) with a modern language such as TypeScript.
I'd suggest you take a look at gtk composite widgets. Also, take the care to use it with a modern language. Be warned that there are no good, well maintained, mature RAD IDE right now.
>To add insult to injury, in Delphi custom components were system-wide, not project scoped and required elaborate installation/registration to show up in the IDE.
It is even worse in Lazarus
To install a component, you have to recompile all of Lazarus
>Also pascal is insanely verbose, i.e. simple list operations (like building list of options for selecbox) span multiple lines of code.
Is one line per element verbose? It is just a function call.
You could write an array ['a', 'b', 'c'] like that and iterate over it
I really hope Lazarus will do away with full IDE recompilation and already adopt Delphi's style of pre-compiled objects (aka .DCU's) when adding a new component to palette in it. Until then it still feels like amateur, not "professional".
That style is for me personally a source of frustration every time I have to add a new component that shares the same name with an existing one, while in Delphi is just a simple error message and you can quickly switch between whichever you want. Heck, in Delphi I can fully name qualify both of them at the same time for runtime. Try do this in Lazarus with one that uses a design time 3rd party component and you're dead in the water.
This is because some major refactoring has to happen in RTTI and system units to support dynamic linking so that true delphi-style runtime dynamic packages can be supported. This is easier said then done because of how many platforms are supported by FPC & Lazarus.
>In contrast, Delphi IDE only runs on windows ... <
And? I don't see that as a minus in a world where virtualization and virtual machines exists. Also in Delphi IDE, in order to target Linux or Android, all you have to do is "select from this drop-down" and rebuild and/or deploy and voila!, you have executables ready to go. You try have a easy switchable Lazarus to compile for a new OS because I gave up. Right now, for each OS I want to target, I have a separate virtual machine with Lazarus installed there. Long live cheap RAM because I can run all 5 Lazarus VM's I need for creating cross-platform executables (Lin/Droid/iOS/MacOS/Win)
Does anybody know an open source platform doing the same in C++ with the same simplicity? I mean an IDE to edit the interface and code.
I used both Qt and wxWidgets, but am not very happy with any of them. Qt can do almost everything, but it is incredibly bulky, and QtCreator is not as immediate to use as Lazarus and Delphi. wxWidgets doesn't have a RAD IDE as far as I know.
Currently nothing tops C++ Builder, and I don't see anyone willing to spend such efforts for free.
Even Qt/QtCreator, do depend on their commercial customers to keep going.
It is incredible that the Lazarus folks are able to still keep the project going, as most people don't care to have nice tooling, rather a couple of free beer plugins for vim/Emacs (and now VSCode).
My only wish for Lazarus is that it would have been neat if it was possible to write Android and iPhone apps using Lazarus and Freepascal. That would have made it a neat platform to develop tools such as point of sale applications etc.
I know there has been some attempts to do this but would appreciate information on whats the status now.
I'm developing a desktop GUI app using Gtk4 at the moment, and I quite like it, including the look/feel of it. The "everything is a widget" approach in Gtk4 makes it much easier to create custom widgets than in past versions, and building on Windows was surprisingly simple (with MSYS2). How does Lazarus compare? I get that it's a whole RAD tool, including IDE, but just in terms of functionality, and ease of extending the components if necessary?
I don’t know if it’s still the case, but Lazarus used to be a part of the high school IT course in Ukraine. Might be that they’ve already ditched Pascal for Python.
Used to be the same in the UK (was my first language), but now they've revamped computing education up and down the country I'd be very surprised if it's still used anywhere
The world is going to be a much better place once FAANG is no longer the path to big money and programmers will have to be content with solving real problems for normal amounts of money like the rest of us.
For those not familiar with the story, Lazarus was a dead guy that got resurected by Jesus of Nasareth in the New Testament.
As in, Pascal was all but dead (tha Java hype was happening with full force) and even the Delphi guys put their best efforts into making Delphi a C++ dialect, but this RAD IDE would resurect Pascal.
Turbo Pascal has been inspiring itself with C++ since Turbo Pascal 6.0.
Where Turbo Pascal 5.5. was basically the adoption of Object Pascal extensions from Apple.
So when Borland rebooted it into Delphi it already had 4 Turbo Pascal releases (5.5, 6.0, 7.0, 1.5 Windows) having such inspiration.
Ironically, while everyone is trying to reinvent the wheel how to interop with C++, Delphi and C++ Builder have been doing it for decades, with .NET and Objective-C++ being followers on that front.
Best of all, is that it allows for C++ like programming, with security belt on by default, but as usual the industry is full of left turns.
The name doesn't refer to a rise from the death of Pascal but an earlier FOSS Delphi clone.
"One of the original projects that made an attempt to build a Delphi clone was Megido. However this effort died. Lazarus as you know was the biblical figure that was raised from the dead by Christ. Soooooo. The project is named Lazarus as it was started/raised from the death of Megido."
I don't think that was actually correct, but Borland did release C++Builder in the 90s that looked and felt just like Delphi, other than the language beneath.
I'm no expert, and Pascal is kind of a weird language by modern standards, but Lazarus does cross-platform desktop development using GTK or QT bindings.
Electron Devs Hate This App!
(ok, maybe not really, but I wish they did!)
PeaZip is written in Lazarus (check out https://forum.lazarus.freepascal.org/index.php?topic=52417.0), and I've seen a few other odds and ends around the net mention the IDE in passing.
Personally I like that it gets and stays out of my way. The UI design copies Visual Basic almost to a T and is a little dated by today's standards, but all the important bits are there.