[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Object Orientation in GTK
- From: SEGV <mlepage cgocable net>
- To: gtk-app-devel-list redhat com
- Subject: Re: Object Orientation in GTK
- Date: Mon, 09 Nov 1998 01:09:06 -0500
Havoc Pennington wrote:
>
> On Sun, 8 Nov 1998, Matthew Ettus wrote:
> >
> > Isn't this essentially like global variables? Just because you throw
> > them all into a structure, it is essentially the same, right?
> >
>
> Not if you use the structure like an object. You don't declare it
> globally; you have a constructor, my_object_new(). You then come up with
> well-defined accessors and you have to have the discipline to stick the
> them, because C won't keep you from doing the wrong thing.
>
> (Though you can use the public/private trick as seen in Gdk:
>
> foo.h:
>
> struct Foo {
> int public_member;
> };
>
> foo.c:
>
> struct FooPrivate {
> struct Foo;
> int private_member;
> };
>
> void foo_method(Foo* f)
> {
> pf = (FooPrivate*)f;
> ...
> }
>
> )
>
> You get the idea. If you stick to the accessors and use dynamically
> allocated objects, you can have OO code, as Gtk does. There's no reason
> you have to use global variables. Though in many cases they are a fine
> thing to use.
>
> Most of the code in Gnome CVS uses this Gtk-influenced style.
>
> Havoc
Um, isn't this a little overboard? Why can't (the collective) we stop picking at
our scabs and just use C++?
For the last few years, whenever I use C I always end up reinventing the wheel:
objects, dynamic function calling, access protection, etc.
Why not just let the compiler do it for you? I mean, I had to laugh when I read
this email. This is so... primitive. Sure, it can be done, but why punish
ourselves?
Just thoughts from a C++ friendly developer. We now return to our regularly
scheduled programming.
--
SEGV http://www.cgocable.net/~mlepage/
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]