167 points · by mariuz · 7y ago · 128 comments
One wonders why we don't have a more generic form of this sort of thing. And no, I don't mean the various "GUI builders" that are out there that produce code you then have to merge with your program, or an XML descriptor that you have to parse with your program, because those are still specific to having bindings for your chosen language.
There really isn't a reason I can think of that I shouldn't be able to throw together a GUI in a WYSIWYG editor and maybe define some basic behavior, then give it one or more programs it should run in the background and pass messages back and forth. Or even let me just tie events to a command pipeline and dump the result into another widget, basically just letting a GUI be part of the composable toolset following the UNIX philosophy.
I learned Java because of the promise (long ago) of write one run anywhere. I learned Ruby because of the promise of Rails. I learned Go because of the promise of fast and single-file-executable (maybe not the best reasons, but those were my excuses :) ). Etc.
How hard can it be to learn Pascal? Is that really a frustration or an obstacle?... If I were making desktop apps, I wouldn't care what language it was as long as I could quickly make cross platform GUI apps that did what I needed.
You've seen code written in language X before and been able to instantly tell it was ported from language Y, right? It's the programmer equivalent of a literal translation from Chinese, where the words are English but none of the metaphors, euphemisms, or subtle connotations are accounted for.
And it isn't even like I have something against Pascal, it seems better designed than C and is just as mature, but I don't really want to invest the time needed to gain fluency at this point in my life. And when I think about that, I wonder why I should need to for this kind of functionality.
Many of us graybeards already know Pascal though. Some even used Delphi and C++ Builder in their heyday, and remember it fondly. It was basically the only sane alternative to VB, with better productivity (instantaneous compilation, even on hardware from 20 years ago!) and a real programming language behind it.
Sure, you can do that, but you need a protocol/interface/API between the GUI and the program(s) it interacts with, and then you need to either manually consume that in the language those programs are in or have a library that handles the interaction, and the problem ends up being essentially equivalent to language bindings directly to the API.
By the way, the "GUI markup language" doesn't necessarily have to be XML-only. Maybe JSON or CSV versions can be defined also. However, XML is a good start: learn to walk before you run.
As far as how interaction and screen changes could be handled, see: http://wiki.c2.com/?GuiMarkupProposal
I particularly dig the 3-type "update" technique that uses "Attribute", "Tag", and "Delete" scope. (It's about half way down in the document.)
https://en.wikipedia.org/wiki/XUL
https://en.wikipedia.org/wiki/Extensible_Application_Markup_...
In a lot of ways it feels like a forerunner of C# (unsurprising as the lead on Turbo Pascal/Object Pascal was Anders Hejlsberg).
I loved Delphi 6, still miss it in some ways.
Java AOT solutions were all commercial (gcj doesn't really count) and .NET had NGEN, but it was only meant for fast startups.
.NET was specially disappointing in this regard, given that it had quite some influences from Delphi.
We had to wait around 20 years for AOT to start being part of the default toolchains.
Had it been there from the start, including proper value and unsigned types in Java, and maybe there would be much less software written in C and C++.
Back then? Intel was barely considered mature, every Unix manufacturer (including sun) had their own processor architecture, and who knew what was coming out for the smaller devices ("thin clients" were all the rage).
I still think that for those scenarios Sun should've stuck with PostScript, and we still might have C/C++, but would be spared JS/HTML/CSS.
I've got no idea why Microsoft was going apesh* for bytecode all of a sudden. Especially considering that they had the heads of Modula-3 and Delphi...
Then again my very first programming experience was in VB so I might be biased :)
If anything is wrong with it, I'd say some of the widgets are little out of date or lacking, but since most of that maps to GTK primitives it's only when you need something weird that you might have to start hacking, since there probably isn't an open-source tool lying around like we'd be used to with JS/ruby/go
I think will be smart to build a Delphi/FreePascal renderer with an API to make easy to embed into other languages (like with TCL).
I sketch some of the idea in https://www.reddit.com/r/rust/comments/9bapwt/thoughts_on_wh...
Delphi/FreePascal integrate very well with C APIs so I think the glue could be easy.
I think that's how the editors in Plan 9 support extensions/plugins/scripting by exposing parts of the editor on the filesystem.
Something with FUSE might do the trick, though mounts are always tricky. Kakoune supports JSON RPC over a fifo, for example:
https://github.com/mawww/kakoune/wiki/JSON-RPC#input-keys--o...
LAzarus provides a great way to address the perception. Fast, free, rich language underneath. Im about to start using in my hobby IOT stuff, but as other posters have pointed out, it works great for Enterprise level stuff as well. Single exe executable is, in my books, a huge advantage.
FTR have started looking at nim as well which seems so far to be bit of a pascal 'reborn' and it also compiles down to single executable. I recommend people look at both if you are needing to distrbute software without the normal installer drama.
Bottom line i believe there is no software silver bullet. Each language has pros and cons and the biggest challenge these days is choosing the appropriate one to use.
While Awk, like C, Is Unix™. Timeless, classic, already there, and cool. This is absolutely just subjective crap, but this is how most of us unix-heads feel :)
Lazarus is a free cross-platform visual integrated development environment (IDE) for rapid application development (RAD) using the Free Pascal compiler.
It's not really "GUI programming" anymore. It's making HTML/CSS/DOM act like a GUI.
I've not been working on GUI programming much since, but I really enjoyed the Qt experience; good tools and superior documentation.
I never liked gtk - much for the same reasons as your Windows GUI C programming; Too verbose for trivial and mundane things.
Don't get me wrong, HTML browsers are fine for most documents and document navigation, but don't scale to real GUI's easily.
Not only have Software development not gotten any easier, most software are slo lots more resources intensive.
https://www.tmssoftware.com/site/tmswebcore.asp or
https://www.elevatesoft.com/products?category=ewb or
https://smartmobilestudio.com/
All three claim to be a form of "Delphi for the Web"
http://www.unigui.com/explore/what-is-unigui
https://www.atozed.com/intraweb/
This one seems to be also available for Lazarus ! http://www.raudus.com/
I wrote an old desktop app for medical laboratories in Delphi (started with D2 ...) and am still quite unsure if this would allow me to port at least some part of it for the web in an (cost and time ) efficient and secure way ...
Does anybody have some experience really using them ?
...Right?
https://anvil.works has a WYSIWYG visual designer, with Python for in-browser code as well as server-side. (We compile it to JS.) It's even got a built-in DB if you want it (Postgres-backed). Everything in one language, full front-to-back autocompletion...all the things we missed about Delphi!
You have some nice looking tooling, but you insist on hosting the result and locking the user into paying rent to use something they built. Your on-prem is locked behind "if you have to ask you can't afford it".
You'd have more interest from people like me if I could just buy or subscribe to your tool and know that even if we eventually drop the subscription the application I produced would still be usable.
But I suspect that your goal isn't to convince people like me, but catch people reading this who might be more amenable to your terms.
Except the insanely fast compile times, native WYSIWYG editor, etc, etc.
It's LGPL, there's no company that can take it away, and it generates native binaries without the bloat and garbage of Qt or the mental gymnastics of C++. It's cross-platform native and really wonderful. Give it a try. The community is awesome.
FreePascal does compile to Java bytecode. It is an experimental feature as far as know, but it's promising.
There is lots to like about FreePascal, even if I dislike the syntax a bit. See the Modern Object Pascal Introduction¹ for reference. But memory handling is something that does not fit my vision. I would hope for something similar to Swift - automatic reference counting. I like that the compiler is not LLVM or GCC based. With ARC I can forgive even the manual UUIDs for components.
That's how I saw it from quite a big height so excuse me if I'm misguided.
At the moment Swift looks promising for me without possible transpilation to Kotlin as seen in one project ². Or D, as it should be easier to fit Java. But I have my eye on Lazarus. It certainly is much more mature a project.
Note that in practice memory management is almost never an issue with FreePascal since a lot of things are based on TComponent that provides an ownership-based model and dynamic arrays (at the language level) handle a lot of cases you'd need to worry yourself. Of course if you create raw objects you also need to release them, but this is something you generally do in constructors and destructors.
> I would hope for something similar to Swift - automatic reference counting.
I'm not sure how i feel about this personally since i think it adds a lot of hidden baggage to the language, but you can use reference counting using "COM" interfaces (the name is just a historic artifact, they work in non-Windows environments too) in current FPC. There is also work to allow any custom type become reference counted by defining some special operators (essentially functions) that the compiler will automatically call to incref/decref/etc (which can also be used to implement RAII).
> With ARC I can forgive even the manual UUIDs for components.
Is the manual UUIDs you are talking about in Swift? AFAIK you do not need to define any UUID in FreePascal (except for the COM interfaces mentioned above).
I do Delphi a lot of years (still remain as moderator in http://www.clubdelphi.com) and can say that is easy to just. Is much easier than use obj-c and the idioms around the language make things simply. Is the only language I have tried with manual memory management that I found simply to follow
P.D: Help a lot strings are refcounted and you can refcount some stuff if desired.
If the target audience is cross-platform, that's hard to pull off. Each OS's native GUI engine is too different. Emulating a common target behavior is usually better (until a good general GUI standard comes along). Maybe your particular need is not cross-platform, but Lazarus's goal is.
The end result is obviously that under Windows things work great, under X11/Linux with the Qt (i think both 4 and 5 are supported nowadays) and Gtk2 being generally fine as they mostly behave like Windows (especially Qt) and the worst being Mac support since it is so different from Windows (that and the Mac backend was originally written using Carbon as that was easier to interface with FreePascal and still to this day is the most robust backend for Mac, although in reality both the Carbon and Cocoa backends aren't that great). And of course the programs despite using native widgets, still look like Windows programs on a Mac dress ([0] is an old screenshot from my 3D world editor compiled under Mac, the Windows-isms are clear). You can obviously try to make things look more Mac-y (and i did try a bit) but you need to do so much (and in a different branch since some changes can be very invasive) that IMO isn't worth the effort unless you really want to get that "Mac look" (but be prepared for a lot of custom code and changes to bypass LCL).
Some months ago I had a need to create a "quick and dirty" API utility for internal use and I remembered about Lazarus.
However I couldn't find an HTTP client component that I could use. I just wanted to do the equivalent of a curl GET/POST call.
I'm not sure if maybe I'm not familiar enough with the wiki structure so I missed it, but I remember I searched for about an hour before I gave up.
I'd really like to start using a Delphi-like IDE again as I think it is a very useful and productive tool, especially for ad-hoc stuff.
Any pointers in the right direction would be greatly appreciated!
`
discogsJson := HttpGet('https://api.discogs.com/artists/45/releases?page=1&per_page=...');
`
Here: https://github.com/synopse/mORMot/blob/54dd708d25586008260f2...
I do remember I clicked on that briefly but I thought it was too low level like you said, and I thought there would be something else so I kept looking.
I guess I was wrong, but it's good to know there is something that works.
It also doesn't look that bad anyway, so I might as well give it a try.
Thanks!
I don't think I personally would want to use Delphi in this day and age, but there's still a lot of useful Delphi/Pascal code out there and it's great to be able to use it on Linux.
I totally understand where you are coming from, however I must say having everything compiled into a static-binary is a powerful thing that we often overlook today.
Case-in-point: Around 2007 I was consulting for a manufacturing facility, basically doing accounting system programming. Their warehouse department needed a small app that basic did two things (a) Check to see if a invoice was marked paid so they could ship, and (b) Record the Fedex / UPS tracking number back into the accounting system.
This was something that was meant to be added into the main accounting application and installed into the warehouse, but there were the usual practical issues (the PC that existed in the warehouse was an under-powered Win XP machine that couldn't actually run the accounting system, so a new machine needed to be purchased...basically weeks of time were required to solve it, but we needed a solution ASAP).
On a whim, I whipped up a simple single-dialog box "utility" in Lazarus / Pascal that would check if accounting had released the invoice and then record the tracking number. Literally took me maybe 3 hours to download, program, test, and deploy.
A few months ago I ran into the product owner from that consulting gig so many years ago....after catching up a bit, asking what had changed...he sheepishly added "I've still never got around to incorporating your warehouse 'utility' into the main program yet". I said 'surely its still not that old WinXP box?' and he said no they had upgraded a few times and just copied the .exe over each time and it continued to work.
Obviously such a simple 'utility' app is not a great example of why you would choose to use a language / platform, but it is a testament that what it does well, it does well. My 3 hours of billable time amortized out over 12 years now was a really good ROI.
If Go had a RAD, well, it'd be very enticing to me. Sadly they have only touched on UI a little. If you want to write something with Win32 API it's not too hard and there's plenty of good libraries, but sadly there's no VCL equivalent. I'd like that.
I guess in that sense Lazarus is still useful. But, I don't find myself needing a RAD too much. What I would've used a RAD for I find Python + Qt to be usable enough for.
Unless you mean in the "delphi mode" specifically (which i'm not sure how it handled generics support), this isn't true since Free Pascal introduced generics support before Delphi did and sadly when Delphi introduced generics they decided to make them incompatible with Free Pascal's syntax (which i personally prefer since it is more explicit).
I've noticed that e.g. Debian installs the Gtk version of Lazarus by default, if you use the virtual package. But it's not clear whether this is a conscious choice, or it just dates back to when they only had Gtk.
AFAIK Gtk2 is the preferred one for shipping since it is still widely available and you can simply give a binary (Lazarus uses a rather old version of the Gtk2 API by design so that it is compatible with almost every Gtk2 distro out there, including some that are a few years old). Qt4 and Qt5 require an intermediate shared library that provides a C API and Pascal bindings for it and in addition Qt4 is removed from some distros.
Even sadder is the fact that instead of having a regular Mac app bundle, the installers spray things all over the filesystem. It’s defensible for the CLI tools, but hardly native.
Still, I look forward to final release - I just hope it has a better native look and feel than 1.8.
In any case C++ support for Lazarus is almost impossible due to the work needed and the projects that will need to cooperate - i go into details here: https://news.ycombinator.com/item?id=15893362
It’s funny when you read about languages like Rust and Go basically trying to undo decades of C-induced damage, reinventing (albeit also exceeding) thangs that Pascal/Modula/Eiffel already had.