Re: Gee Functional iterators - call for consensus



Hi,

I intended to write this for quite some time - I am sorry that it took so long.

I have looked at the implementation and proposal for "functional
iterators" and I have some remarks and things I really don't like.

- Implementation directly on iterator interface: Even if it is legal
to do it in GObject I don't like that the interface contains the
implementation and then you are forced to override it in your
implementation just to do something different. This is for example
also the reason for the existence of AbstractCollection and co.
because neither I nor Didier did not want to put code into the
interface. I hope you will also change this for the iterators.

- Stream function: Stream function is for me just a implementation
detail how the functional iterators are implemented. I don't think it
is wise to force it into the interface of iterator. They should be
available but only as a special type of iterator or something similar
that is just used as the implementation and hidden on the interface. I
also don't think there will be a lot of people that will write its own
functional operator anyway. I must also say that I don't like that
stream operation as it is very hard to read what exactly it does and
how it works. The performance might also be an issue as functional
programming languages are heavily optimised for (tail) recursion and
lambda but vala is not. Still if the stream operation is just regarded
as a implementation detail I don't mind.

- Call to iterator() before executing an functional operation is not
elegant. Each collection could have functional operations directly
accessible as well and just could delegate to the iterator when it is
called.

- In my opinion a functional operation is in itself an special
iterator not an additional method on iterator itself. I don't like
that I can call iterator() and do next() next() next() and afterwards
call a functional operator. What can I expect in such an case? Also
there is nothing preventing an Iterator to never end the iteration
(not in any implementation in libgee but doable with a custom
iterator). What can I expect in such a case from an functional
iterator?

I hope you don't take this negatively this is my personal opinion and
I also may be wrong. :) Generally I like the interface.

I have also implemented how I think the functional iterators should be
implemented (however I am not totally happy with the code but it
should be good enough as an example).
The code is available as a clone of your repository in gitorious in:
http://gitorious.org/~quikee/libgee/quikees-mpiechotkas-libgee/commits/functional-iterators

Regards, Tomaž

On Sat, Jun 25, 2011 at 14:26, Maciej Piechotka <uzytkownik2 gmail com> wrote:
> The (hopefully) final draft of functional iterators is pushed to my
> gitorious repo[1] in functional-iterators branch. They are missing the
> tests for stream.
>
> I took the liberty of adding vala ML as it seems not everybody who may
> be interested in this is aware of existance of libgee ML.
>
> Best regards
>
> [1] https://gitorious.org/~uzytkownik/libgee/mpiechotkas-libgee
>
> _______________________________________________
> libgee-list mailing list
> libgee-list gnome org
> http://mail.gnome.org/mailman/listinfo/libgee-list
>
>


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