:: Re: [DNG] GTK (was Will there be a …
Kezdőlap
Delete this message
Reply to this message
Szerző: T.J. Duchene
Dátum:  
Címzett: Isaac Dunham
CC: dng
Tárgy: Re: [DNG] GTK (was Will there be a MirDevuan "WTF"?)


On 7/23/2015 10:41 PM, Isaac Dunham wrote:
> I'm inclined to agree with you on C++, but I'd like to refer you to Roger
> Leigh's comments on the subject about seven and a half months ago;
> I'm only appending the first couple screenfuls (which is maybe a third
> of the original) but you should be able to find the original email given
> the headers and this text.

I don't have a high opinion of GTK either. Honestly, I never did, but
my opinion is subjective rather than objective. I never bothered to
learn GTK to a great extent. I knew enough "back in the day" to hack
the gnome-panel and add a new option or two that Gnome did not have, and
I kept my changes to myself. That was the extent of my interest.
Generally, I have a low opinion of UI kits because the designers tend to
be horribly inconsistent. After GTK3 was released, I knew it was on the
downhill slide. They should have started over from the ground up, kept
it generic, and added support for Qt desktop integration. GTK has
basically become part of Gnome, and no one of consequence except Gnome
uses it.

I've seen very little new software written that uses GTK, except for
things that use the Python bindings. (Yes, I despise Python, but will
not discuss it here.) Most of it is very buggy. In fact, I would say
with confidence that GTK has receded so much that except for software
that already uses it as a legacy, no software of any quality is being
produced using GTK. It has even lost a few. Both Canonical and Google
have either completely abandoned it or are choosing alternatives for new
projects.


Now then, as for Roger's comments, I find them confusing.
> [snip]
>
> The C API is overly complex and fragile. You don't want to base your
> project on a sandcastle. And the expertise required to use it is
> very high. Implementing dynamic typing and manual vtable construction
> rather than using C++ which does proper type checking? Just use C++!
>

C and C++ are both strongly typed, so I am assuming that he must be
referring to GTK using a pointer in C presumably to dynamically handle
function names and data for polymorphism. He can't help it if GTK is
sloppy, but I can't make sense of his grievance either. Type checking is
never C's job, it's his! That is explicit in the design of the
language. Everyone who uses C knows that. C++ is the same for that
matter. Neither language checks your variable data for type.

I've always noted the GTK code tends to leak. If programmers with
experience can't be bothered to clean up after themselves, I'm glad GTK
is dying off.


> In fact, you have to be an expert in C++ compiler internals just to be
> able to understand and use it effectively.
>
> [snip]
>

That's somewhat true, but if you write C++ code PROPERLY - i.e. make
sure you references are clean, resources released, and you aren't
leaving any hanging exceptions, what he is claiming is pretty much a
non-issue in the context of any OOP language. A C++ compiler is no more
mysterious that any of the other OOP crap we are forced to endure. C++
code is simply not as robust as C. You can mitigate a lot of the
annoyance; like exceptions that cause premature exits - but you are
never really rid of it.

I think a lot of GTK's problems could be solved if it were rewritten to
take advantage of C11, but I don't see that happening. I doubt Gnome
has enough people willing to do it.