RE: glib: changes to the g*_array API.




> > > Now that we've decided there should be two behaviors, and I hope we can
> > > agree on using two functions, the decision remains as to the
> default.  We
> > > can have
> > >	    g_ptr_array_remove_index_preserve
> > >	    g_ptr_array_remove_index
> > I would prefer this. The 'shorter' function is the faster one. If somebody
> > is looking for a 'preserve order' function, he will certainly find it.
>
> NO ! When I was browsing through the list of functions, I saw this function
> and I never got the idea that it might distort the order of the elements in
> the array ! So even if the docs of the function explicitly state this, it
> is more natural to assume that "remove_index" just does what the function
> says: It removes an item. The name of the function gives no hint that it
> might do some kind of shuffling. Therefore you should make
> "g_ptr_array_remove_index" keep the order and add
> "g_ptr_array_remove_index_quick" which doesn't.

I agree with this. Arrays are considered to be ordered so the standard
function should do the intuitive thing.

The reason that GArray, and GByteArray, don't have this problem is that they
don't currently have functions to remove elements!

Damon





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