archives

« Bugzilla Issues Index

#4168 — Mark parameters of generator methods as optional


Sect.: 25.3.1 Properties of Generator Prototype

In several other locations, parameters are marked as optional via square brackets. It may make sense to do that in this section, too.

E.g., how about the following headings?

Generator.prototype.next ( [value] )
Generator.prototype.return ( [value] )
Generator.prototype.throw ( exception )

Long-term, TypeScript’s notation could be adopted (I have done so in my writings and it works well).


The signature optional-ness has implications for the length property of the method. In particular, we generally set the length for methods newly defined in ES6 to be the length that would be generated by a corresponding ES function declaration with that signature.

In this case, I don't think we want the length of 'next' and 'return' to not change from 1 to 0.

Changing the spec. signature really has no other implications other than suggesting what is "normal" and in this case I think that all depends upon specific use cases.