On Wednesday 04 April 2018 09:07 PM, Sven Van Caekenberghe wrote:
Good summary, I agree.

Still, what are the semantics of #next - does the caller always have
to check for nil ? Do we think this is ugly (as the return value is
outside the domain) ? Do we then still need #atEnd ?

Senders of #next should be prepared to handle errors and EoS is just one of them.

On exhausting all elements in the collection, #next could block waiting for next object to become available or check for errors. Reading past End is just one of the error conditions. One way to recover from EoS error is to return an sentinel. The exact sentinel object could depend on the collection. Eliot suggested a good one earlier in this thread.

Regards .. Subbu

Reply via email to