This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Support Iterable in for-each


Hi Per,

I was wondering if you think it would be possible for the `for-each`
methods and friends to accept directly a Java `Iterable` object.

That would greatly ease Java usage since it would not be necessary in
a lot of cases to transform an `Iterable` to a native list. However, I
fear that it would not be that easy because maybe a lot of stuff
relies on car/cdr.

But we could make them compatible with `Iterable` though, where `car`
returns first element from `Iterable` object and `cdr` returns an
`Iterable` representing the rest elements and for a single element
list, returns maybe an empty `Iterable`. But this would implies some
more logic changes on `null?` and maybe other methods so it's possibly
far-fetched and potentially a BC break (I don't think so but it may be
the case).

Of course, I could have my specialized function of `for-each` and like
to do the job, but I think having "native" support if possible is
always better.

Had you had some thoughts on this subject before?

Regards,
Matt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]