Re: gobject
- From: Emmanuele Bassi <ebassi gmail com>
- To: Timothy Ward <gtwa001 gmail com>
- Cc: ML-gtk <gtk-list gnome org>
- Subject: Re: gobject
- Date: Thu, 20 Oct 2016 15:01:20 +0100
Hi;
On 20 October 2016 at 14:50, Timothy Ward <gtwa001 gmail com> wrote:
Yes. Ideally, the "new" style, with G_DECLARE_* and G_DEFINE_TYPE,
should be used for all newly written code, as it allows not only
hiding the internals of the type system, but also allows GLib
maintainer to update the best practices for creating types without
requiring vast amounts of code rewrites — just a rebuild.
The referenced docs do not provided full explanations or examples
of
either.
What kind of full explanation are you looking for, precisely?
How to code both types - explanation of the boiler plate code
what it is for and how to code it.
That's the rub: writing down what the boilerplate code is means that
we commit to it for all eternity — or, at least, until a major API
break.
The whole idea of using the macros is not just to avoid the
boilerplate: is to make it irrelevant to know what the boilerplate
does, unless you're literally hacking on the type system itself.
Given that GObject is mostly based on conventions more than API, to
make up from lack of syntactic sugar, following conventions and best
practices is generally the right path.
If you want to know what the macros do, you can still look at their
API reference:
https://developer.gnome.org/gobject/stable/gobject-Type-Information.html#G-DECLARE-FINAL-TYPE:CAPS
https://developer.gnome.org/gobject/stable/gobject-Type-Information.html#G-DECLARE-DERIVABLE-TYPE:CAPS
https://developer.gnome.org/gobject/stable/gobject-Type-Information.html#G-DEFINE-TYPE
and the conventions used by GObject-based code:
https://developer.gnome.org/gobject/stable/gtype-conventions.html
and, eventually, to the macro implementation, inside gobject/gtype.h.
Ciao,
Emmanuele.
--
https://www.bassi.io
[@] ebassi [@gmail.com]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]