Why is it useful/necessary that a generator be both an iterable and an iterator?
I think of iterable and iterator as quite distinct, e.g. a collection is an iterable, this means I can ask for an iterator on it and each time I do so I get a new iterator that allows me to step through the complete collection once.
A generator appears to be most like an iterator, i.e. once you step through its elements once you can't do anything more with it, yet as well as implementing next() it implements the get-iterator logic of iterable but only such that this logic returns the generator itself:
$ node
> const genFn = function* () { yield *[1, 2, 3]; }
> const gen = genFn();
> gen.next();
{ value: 1, done: false }
> gen == gen[Symbol.iterator]();
true
> for (const val of gen) console.log(val);
2
3
Why is it necessary that a generator be an iterable in addition to being an iterator?