4 ms·
> It makes the point that you shouldn't have to know if the iterator is lazy or not, that's an implementation detail. That's both right and wrong. That it's a
by dragonwriter 6y ago
> It makes the point that you shouldn't have to know if the iterator is lazy or not, that's an implementation detail.
That's both right and wrong. That it's a lazy iterator itself may be an implementation detail that doesn't effect the interface (if the interface doesn't assure reusability; a concrete collection and a lazy iterator do have different behavior in important ways) but leaving a dangling external resource is not. For certain resources, when you are given a reference rather than the opened resource, you can't build a lazy iterator without also leaving dangling external resource that the caller doesn't have the information to close. That is a significant difference.