5 ms·
GObject always felt like a poor man's Objective-C to me. It's a shame that the language was so completely sidetracked in '90s open source Unix development. I s
by pavlov 9y ago
GObject always felt like a poor man's Objective-C to me.
It's a shame that the language was so completely sidetracked in '90s open source Unix development. I suspect part of the blame goes to GNUstep's ambitious overreach. Maybe if they had just focused on an Obj-C widget toolkit instead of building an entire NeXT look-a-like desktop, it would have been more palatable to the wider community.
- fulafel 9y agoNeXT were hostile about open sourcing their Objective-C platform that was based on a fork of the GNU toolchain, indeed it was one of the early GPL enforement cases where lawyers got involved. But they still kept the runtime and li braries closed.
- camus2 9y agoObj-C is nice, but it's not like they couldn't use C++. So why not just C++? why this obsession with C even when it makes no sense?
- pvdebbe 9y agoC is a vastly simpler language with good and well-tried semantics. The simpler language spec may make sense to do OO with suboptimal tools vs C++.
- camus2 9y ago> C is a vastly simpler language with good and well-tried semantics.The simpler language spec may make sense to do OO with suboptimal tools vs C++. But GObject isn't a simple type system on top of C, A C compiler wont catch any GObject type error since everything is about casting "types" with macros, a C compiler has absolutely no understanding of GObject type system. I don't believe one second writing GObject code is simpler than writing C++ code, having looked at serveral GObject codebases.
- marktangotango 9y agoNo one claimed gobject c was simpler to write than c++. That would be a foolish claim.
- pavlov 9y agoTraditionally C++ hasn't had a stable ABI. Object code from different compilers and even compiler versions has been incompatible. That made it a no-go for system frameworks. It's the same in Apple land: macOS uses a lot of C++ internally, but it's all wrapped into plain C APIs using an object system called CoreFoundation (which is IMO better than GObject because it was designed for "toll-free bridging" with Objective-C, so there is a low-friction path to a higher level language). There have been operating systems that built their APIs in C++. BeOS and Symbian are the most notable ones. Both ran into serious trouble with the ABI being tied to a specific compiler, which in practice made it hard to port newer GCC or Clang.
- andrioni 9y agoHow did Microsoft solve it with their C++ APIs? I've never ventured much into Windows programming, but I remember hearing that MFC uses C++, and newer stuff is mostly C++-based.
- pjmlp 9y agoUsually everyone makes use of COM. With Longhorn's failure, most of the .NET APIs that were part of the design how Longhorn was supposed to be, became COM APIs in Vista. Since then all major APIs were always COM based, with WinRT design goal being to do with COM what was originally imagined for Longhorn. Just that the COM APIs in UWP have been improved. Interfaces must inherit from IInspectable instead of IUnknown and .NET Metada is used instead of COM type libraries. COM allows any language on Windows that can interface with it to have access to an OS OO ABI. Which means any .NET language, Delphi, C++ and if feeling masochist C. EDIT: I think Ruby and Python can also consume COM. I also forgot to mention VBScript and JavaScript.
- thriftwy 9y agoThey carry around their bridge library called MSVC redistributable, and that one is tied to compiler version. Fortunately for them they don't release compiler versions too often, but stuff you have on your Windows install perhaps carries around half dozen of MSVC redistributable library sets. All Windows APIs are still C (stdcall to be precise) with some COM.
- pjmlp 9y agoBecause UNIX was always a C territory, it is like asking why the obsession with JavaScript on the browser. Back in the day, on the heat of the C vs C++ language wars on GNU/Linux, the C guys would pick GNOME and the C++ guys would be KDE. Then there were those of us that would gladly pick KDE, if it wasn't for the license Trolltech was originally using, so there was the effort to create Gtk-- and Gnome--, which wasn't that well seen, back then. Back then the GNU Coding Standards suggested using only C[0] which helped language's adoption, in a world where OS/2, Windows, BeOS and Symbian were heavily adopting C++. At least nowadays they acknowledge there are other programming languages that can be used. [0]- https://www.gnu.org/prep/standards/standards.html#Source-Language https://www.gnu.org/prep/standards/standards.html#Source-Lan...
- deleted 9y ago[deleted]
- lukaslalinsky 9y agoGObject has a much richer object model than what C++ provides out of the box. They could have used C++ and added the other semantics, but then you would end up with something similar to QObject in Qt and people would complain about that too.
- camus2 9y ago> GObject has a much richer object model than what C++ provides out of the box. They could have used C++ and added the other semantics, but then you would end up with something similar to QObject in Qt and people would complain about that too. But C compiler doesn't support GObject system. A C++ compiler obviously does support C++ types. GObject might be richer but writing GObject code is like coding in Javascript. The compiler isn't going to detect any of your type mistakes. this is not acceptable for someone who isn't familiar with GObject complexity. Qt is much much easier to work with, even for a bad C++ programmer.
- NelsonMinar 9y agoI agree, Objective C was a nice little language. In the mid-90s I worked on one of the few (only?) non-NeXT Objective C projects, the Swarm Simulation System. We chose ObjC over C++ because it was simpler and more dynamic. At that time the GNUstep project was pretty new and most of the good stuff was in the GNU ObjC compiler and small runtime. It worked pretty well, particularly the very clever tclobjc binding that made it easy to script Objective C programs. I've never used Apple's modern ObjC but from the code samples I've seen it got pretty complicated.
- accatyyc 9y agoOne might say complicated, I say feature rich! I think it's a shame that all focus is on Swift right now, because Objective-C has seen so many improvements in the last years, and it's now an incredible, mature language IMO. Wonderful to work in, and while I do dabble in Swift occasionally at work, and it has some neat features, I would still not choose it above Objective-C for any new stuff I'm building.
- mpweiher 9y ago> few (only?) non-NeXT Objective C projects I worked on another, the Infopark Fiona content management system (formerly NPS). We started with the GNUStep foundation and later switched to libFoundation and a bunch of custom frameworks for Web and DB. That experience made me realize that conventional wisdom was, as usual, wrong. It's not true that language is unimportant and only the frameworks count. With the right language, you can easily build the right frameworks for your needs. There was/is also a bunch of telecoms work in messaging with GNUStep.