LWN.net Logo

Release Notes and GTK3

Release Notes and GTK3

Posted Sep 25, 2008 6:18 UTC (Thu) by alankila (subscriber, #47141)
In reply to: Release Notes and GTK3 by rahulsundaram
Parent article: GNOME 2.24 available

Eyes boggle. If I'm reading this correctly, they plan to remove structure field accesses even for public fields. No more

image->visual->depth,

I guess it's

gdkvisual_get_depth(gdkimage_get_visual(image)),

or maybe even

g_object_get_int(g_object_get_object(image, "visual"), "depth").

I don't see the improvement. Hiding private fields may be tenable as nobody is supposed to poke at them anyway, but this seems to go beyond sane.


(Log in to post comments)

Release Notes and GTK3

Posted Sep 25, 2008 7:01 UTC (Thu) by epa (subscriber, #39769) [Link]

If they want C++, I don't see why they don't just use C++.

Release Notes and GTK3

Posted Sep 25, 2008 9:07 UTC (Thu) by kripkenstein (subscriber, #43281) [Link]

> If they want C++, I don't see why they don't just use C++.

C++ isn't trivially portable and has various other issues. Regardless, at this point in time it would be better to use an even higher-level language. The natural candidate would be Vala, of course.

A combination of Vala and the related projects of GNOME-introspection, automatic bindings generation, etc., for higher-level languages on top of that, would have been a compelling target for GTK3.

Release Notes and GTK3

Posted Sep 25, 2008 14:21 UTC (Thu) by nix (subscriber, #2304) [Link]

That syntax is dramatically worse than C++'s syntax.

Release Notes and GTK3

Posted Sep 25, 2008 7:21 UTC (Thu) by tetromino (subscriber, #33846) [Link]

If you allow direct access to structure fields, there is basically no sane way to implement new classes in languages such as Python or Java. One of the goals of Gtk+ 3 is to make non-C languages into first-class citizens.

Release Notes and GTK3

Posted Sep 25, 2008 9:28 UTC (Thu) by alankila (subscriber, #47141) [Link]

Can you expand a bit on this idea? I do not understand what new classes you are talking about, and how does it help to make it more difficult to access the public members?

Release Notes and GTK3

Posted Sep 25, 2008 10:30 UTC (Thu) by epa (subscriber, #39769) [Link]

If you allow direct access to structure fields, there is basically no sane way to implement new classes in languages such as Python or Java.
That's often true, and yet it is a real annoyance to cruft up the syntax with 'a.setY(b.getX())' instead of 'a.y = b.x', and to write boilerplate methods for every field you want to expose.

C# deals with this in an elegant way by allowing properties with 'get' and 'set' methods which are exposed through the normal syntax. If you don't want the accessor to do anything except set the field, it can be generated for you, so no boilerplate is necessary. I hope other languages will adopt something similar.

Release Notes and GTK3

Posted Sep 25, 2008 11:36 UTC (Thu) by dgm (subscriber, #49227) [Link]

Can you propose an use case for this (somebody writing new GTK classes in Java or Python)?
It's not clear to me if you mean mere subclassing in an application's code, or subclassing for writing new classes for others to consume.

Release Notes and GTK3

Posted Sep 25, 2008 7:27 UTC (Thu) by tajyrink (subscriber, #2750) [Link]

I guess it's time for some Vala, then :)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds