Web lists-archives.com

Re: gobject




On Thu, 2016-10-20 at 15:01 +0100, Emmanuele Bassi wrote:
> Hi;
> 
> 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.

This was to be able to understand when studying code that has it
already incorporated but I understand your purpose below.
Thanks for the great references.
> 
> 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-Informatio
> n.html#G-DECLARE-FINAL-TYPE:CAPS
>   https://developer.gnome.org/gobject/stable/gobject-Type-Informatio
> n.html#G-DECLARE-DERIVABLE-TYPE:CAPS
>   https://developer.gnome.org/gobject/stable/gobject-Type-Informatio
> n.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.
> 
Regards

Tim
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list