Web lists-archives.com

Re: gobject


On 20 October 2016 at 14:50, Timothy Ward <gtwa001@xxxxxxxxx> 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

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:


and the conventions used by GObject-based code:


and, eventually, to the macro implementation, inside gobject/gtype.h.


[@] ebassi [@gmail.com]
gtk-list mailing list