RE: The iterator interface



On Mon, 2006-08-07 at 11:31 +0300, Dirk-Jan Binnema nokia com wrote:

> That sounds like a good plan; make 'm void. And then maybe add 
> ref'ing and non-ref'ing versions of _current, maybe with a bool flag?
> 
> ie.
> GObject* tny_iterator_iface_current (const TnyIteratorIface *self,
> gboolean add_ref);
> 
> (adding the const as well, for good taste :-). Of course I can make the
> changes,
> but do you agree?

I agree but without the boolean flag. I think it's better to simply be
consistent and always add the reference.

I already checked and noticed that the unit test needs most changes.
Other than that there's a few locations in the code where first and nth
are used directly. Those need to be changed with _current of course.

And of course unreferenced once the instance isn't needed anymore.

So I agree but I'm more pro a consistent "always add the reference".

A reason for this is language bindings. I don't think that boolean flag
is going to look meaningful in a higher language with garbage
collection.

Maybe Python-James has a idea on this?



-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be




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