Re: g_(s)list_data()



Joel Becker wrote:

> On Thu, May 24, 2001 at 05:08:18PM -0700, Derek Simkowiak wrote:
>
> >       Although g_list_next() exists, it has been agreed that there is
> > way too much code that directly accesses list->next to deprecate that kind
> > of peeking.  In short, even if list->next was meant to be private, through
> > real-world practice it has become public.  And since list->data is already
> > public, there is no need for g_list_data().
>
>         I know folks use list->next and list->data.  I am not, in any
> way, claiming we can fix it in existing code.  But we can provide pretty
> accessors for new code that some folks might like.

Personally, I too prefer information hiding, encapsulation, and all that jazz.
But the real answer to this question depends on whether the GLib team considers
the list structures as opaque data types or not.  If lists should be opaque
data types, then the data accessor should be added.  If not, then the next and
prev accessors should be removed.  Right now, the list structures are
"straddling the fence".

Eric.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]