6 ms·
GObject
- jonathankoren 9y agoShudder. I remember looking st this 15 years ago, and it's a cruel joke. I understand why writing in C made multilingual bindings easy, but the ergonomics of GObject are horrible. You're stuck doing all the crap that real OO type system does, setting up vtables and what not. Most insulting, they dismiss(ed) all complaints as mere "syntactic sugar". Ironically, I liked GTk+ back when I was doing that kind of stuff.
- chris_wot 9y agoIt's an entire portable object system. It does more than I suspect you think it does!
- jonathankoren 9y agoI think it does none of it in a way that's easy to use.
- tsarfox 9y agoI agree. Using GTK+ for a small personal project made me realize just how unwieldy GObject is. Vala was a nice alternative, in my opinion, but it seems that everyone is trying to kill it off nowadays.
- narrator 9y agoI also looked at gtk c++ programming in the late 90s and was disturbed by GTK--, the c++ binding at the time. The library used extensive template meta-programming that was so ugly that it made me give up on c++ as a language. The error mestages the compiler would vomit were often many lines long and took considerable time to decipher.
- pjmlp 9y agoGtkmm was what made GNOME programming a sane alternative to Qt, back in the day of the license wars. It was that template meta-programming that allowed us to offer the same event handling capabilities as Qt, without having language extensions based on an external tool like moc.
- gkya 9y agoNowadays there's Vala which is a C# like language compiled to C+GObject.
- pavlov 9y agoGObject 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 ago
- _RPM 9y agoGObject is the most interesting source code in C I've read.
- vanderZwan 9y agoCould you explain? I'm probably not familiar with C to get why even if I tried it myself.
- pritambarhate 9y agoA little bit offtopic: I am somebody who has programmed in memory managed programming languages for all of my career. (With exception of Obj-C for a couple of years before ARC) I recently wanted to try my hand at C. But was surprised that there isn't a Boost like lib for C. What is a good generics/data structures library for C? Glib is one option. But it is supposed to be hard to use. Apache Portable Runtime seems to be another option. I read somewhere that its memory pools were considered to be a bad design and were supposed to be removed in the newer implementation. But the current stable version seems to use them.
- lathiat 9y agoglib seems to be a common go-to even for otherwise non-gnome projects
- marktangotango 9y agoThese are the two options I know of as well. Glib is relatively approachable imo, I also think the docs are better than apr, and there are more examples around. In the end I was interested in writing server apps, so I just used go.
- emmelaich 9y agoThere's also NSPR (Netscape Portable Runtime). Still maintained after all these years. https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NS...