Ѓорѓи Ќосев (2013-11-18T10:34:07.000Z)
domenic at domenicdenicola.com (2013-11-22T17:55:05.655Z)
On 11/15/2013 06:18 PM, Claude Pache wrote: > The other point of view is that this preference is consistent with > other generator forms where the asterisk is after the token that > defines the general role of the construct as a procedure (either the > `function` keyword, or the `=>` token). Personally, I tend to read > `function*` as a unit meaning "generator function", and so would I for > `=>*`. There is one reason (that is beyond bikeshedding) why I think the star should be together with the arrow. (I have no opinion whether it should be before or after the arrow though) Its harder to scan whether this is a generator arrow function or a normal arrow function because the star is too far away: someFunction(*(someArgument, anotherArgument) => { ... code ... }); compared to this form, where its immediately obvious that this is not a regular function, just by looking at the composed symbol (arrow-star) someFunction((someArgument, anotherArgument) =>* { ... code ... }); The arbitrary length of arguments, as well as the ability to split them to multiple lines makes it potentially even harder to reliably locate the star: someFunction(*(argument, anotherArgument, somethingThird) => { ... code ... }); vs someFunction((argument, anotherArgument, somethingThird) =>* { ... code ... }); Here is the single-argument example, for completeness: someFunction(*singleArgument => yield asyncOp(singleArgument)); versus someFunction(singleArgument =>* yield asyncOp(singleArgument)); in which it looks like the star is somehow related to the argument. If you're not convinced, you can try to find all the arrow-stars in the above code, then try to find all the arrows and determine whether they're generator arrows or regular arrows :)