In the informal diagram:
* Move @@iterator() from (Generator).prototype to (IteratorPrototype)
* Suggestion: REPLACE function *g1() {yield} WITH function* g1() {}
* Object name: REPLACE new g1() WITH g1()
@@iterator has been moved
I think the "yield" is ok an a reinforcement that this is a generator function
have new on the g1 instance is consistent (other than the missing () ) with what is shown for f. It seems like a good re-enforcement that it is an instance.
I think I'll keep the new, but drop the ()
I find it interesting that:
1. a generator function is so much like a constructor function,
2. but not invoked via `new`.
#1 is nicely explained diagrammatically, via the `instanceof` line and because g1 has a prototype. I would explain #2 by showing that g1 is invoked without `new`, that its invocation looks like a function call. You are showing something that is not legal JavaScript and I suspect that that may confuse readers.
Generator functions are new-able. See http://people.mozilla.org/~jorendorff/es6-draft.html#sec-generator-function-definitions-runtime-semantics-evaluatebody
BTW, the main purpose of diagram is to help implementors (and others) understand how this is all wired-up
(In reply to Axel Rauschmayer from comment #2)
BTW, feel free to borrow that diagram or a variation of it if you're so inclined.
“Generator functions are new-able.”
Ah, wasn’t aware. That nullifies my objection.
“feel free to borrow that diagram”
Thanks! Working on it, first try: https://twitter.com/rauschma/status/568063153755594752
fixed in rev35 editor's draft
fixed in rev35