Use of complete GList functionality? Change to GSList?

Bill Gribble
Mon, 5 Mar 2001 09:20:00 -0600

On Sun, Mar 04, 2001 at 08:58:07PM -0500, Derek Atkins wrote:
> One of my major issues with the GList construct is that there is no
> way to validate the _type_ of list you've got.  In other words, there
> is no way to be assured that you have list of type foo.  I could pass
> a GList of type foo to a function that is expecting a GList of type
> bar, and there is no way to detect that.  :(

Well, RLB has addressed this problem with g-wrap by making it a
design-time problem.  You can specify in the g-wrap def file that a 
GList has a certain type of pointer in ->data... in fact, you are required
to do so... and it's a design "contract" on the C side that you must
build glists with that type.  

It's not compile-time type checking, or even run-time type checking,
which would be required for it really to be a contract, but there is
at least a handshake agreement that functions that return GLists
return GLists pointing to a certain type of data, and that that type
is documented in the g-wrap interface def file if nowhere else.