3 ms·
> You'd have to overload "for" to detect whether the expression implemented Iterable or Iterator to decide what to do Iterator implements Iterable as a trivial
by masklinn 13y ago
> You'd have to overload "for" to detect whether the expression implemented Iterable or Iterator to decide what to do
Iterator implements Iterable as a trivial self-return (by default), and `for` only and always takes an Iterable?
> what if you implement both?
Depends what sort of weirdness you're trying to do I guess.
> I believe it didn't work with the trait matching rules.
Ah. Too bad.
- pcwalton 13y agoYeah, I would rather have "for" defined only to operate on Iterables. If we modified the trait matching rules we could probably do that backwards compatibly post 1.0.