4 ms·
Well, I also want to use my own language's objects, and GObject Introspection enables that. With a library written in C++ I can't do anything from most languag
by ptx 7y ago
Well, I also want to use my own language's objects, and GObject Introspection enables that.
With a library written in C++ I can't do anything from most languages. Very few languages offer C++ interop.
What language would you suggest the platform GUI library should be written in if not C? You can't use Qt's C++ objects from Java or Swing's Java objects from C++, but both can call C.
- lmm 7y agoYou can - and do - use Qt's C++ objects from Python in a very native way, as though they were just ordinary Python objects. I would imagine the same would be the case when using Qt from Java or any other language that offers bindings. And since C++ with its class system is a widely adopted standard (for good or ill), there is at least some appetite for offering good bindings to object-oriented C++ libraries among the wider community, and any improvements or techniques there will generally cross-pollinate to improved bindings for Qt and vice versa. In theory GObject is intended to be a whole parallel OO ecosystem, a better way of doing objects in C-like languages that can compete with C++, and that would ultimately give rise to a whole platform of things like Vala that interop with that platform. However that whole ecosystem just hasn't caught on; outside of Gnome, no-one is using GObject, no-one is using Vala, and so no-one else is interested in working on bindings between other OO languages and GObject (which have to solve much the same problems as bindings between those languages and C++ - GObject may be "C" but it relies heavily on macros, and to bind it in a usable way that makes it feel native in an OO language you have to do a lot more work than just exposing C functions as functions).
- xfer 7y agoThere is a reason there aren't any close to complete bindings for other languages except python for Qt5. It takes significant effort compared to binding to Glib/Gobject especially with gir.
- einpoklum 7y agoQt is not a "fair" comparison. I mean, yes, it's relatively popular, but: 1. It's a huge framework, not just a GUI toolkit. 2. It uses the not-really-C++ mechanism of signals and slots and a "meta-object compiler". Thus, for example, wxWidgets - written in C++ - has bindings in Lua, Python, Ruby, Rust, Java, Javascript, etc.
- einpoklum 7y ago> GObject Introspection enables that By definition, not really. I can't be not-using GObjects if I _am_ using GObject introspection. > Very few languages offer C++ interop. bu they do offer Glib interop? I don't mind having a C API (for a C or C++ library), and modern C++ inside.