On 13/07/10 13:17, Martin DeMello wrote: > I asked about functional methods (map, filter, fold, etc) on the vala > mailing list, and Didier pointed me to > https://bugzilla.gnome.org/show_bug.cgi?id=589968 > > I'm new to vala in general; could someone explain why adding methods > to, say, Iterable would break the API? >
Because method add to interface means any class which implemented the
interface must implement additional method. Which it currently does not
implement.
It may be changed by fixing Vala bug 546305[1]:
public delegate <A, B> A FoldlMethod(A, B);
public class Iterable<G> {
public Iterator<G> iterator();
// OK. Anyone can provide more optimized version -
// but doesn't have to
public virtual A foldl(FoldlMethod<A, B> f, A i) {
Iterator<G> iter = iterator();
while(iter.next()) {
i = f(i, iter.get());
}
return i;
}
// ...
}
> (Also, if we're looking for a good set of methods to implement, Ruby's
> Enumerable module and the Haskell prelude would be a good source of
> inspiration)
>
(I love Haskell ;) )
> martin
Regards
[1] https://bugzilla.gnome.org/show_bug.cgi?id=546305
signature.asc
Description: OpenPGP digital signature
_______________________________________________ libgee-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/libgee-list
