Usability of GSequence API


I've been reading the GSequence threads here.  I finally had a look at
the committed API today and my first impression is "over-complicated".

The main issues I see with it are (other than just the large number of
functions for something as simple as a sequence):

  - GSequenceIter is used both as a "node" reference and as an iterator.
For example, the way to get/set the value of a node is to do that using
an iterator pointing at the node.

  - There are several methods that take a GSequenceIter but are not
prefixed with g_sequence_iter.

  - Some methods names hardly suggest the semantics of the operation.
For example:

void           g_sequence_move               (GSequenceIter            *src,
                                              GSequenceIter            *dest);

What does it mean to move a iterator to another one?  It's still not
clear even if you s/GSequenceIter/GSequenceNode/.

  - Unlike the common idiom, iterators are not allocated and freed.
They are really just pointers to nodes.

Note that I did not read the docs, just the header, and did that on

I totally agree that we need a higher level datastructure than GList in
glib.  Just that the GSequence API is too different from other glib
datastructures that I know that is confusing to me.

My 0.02 CAD


"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

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