tc39 / proposal-generator-arrow-functions

ECMAScript proposal: Generator Arrow Functions
115 stars 5 forks source link

Generator arrow functions proposal repo #6

Closed chicoxyzzy closed 4 years ago

chicoxyzzy commented 5 years ago

Generator arrow functions proposal (stage 1) doesn't have its own repository. Can I help with it? If someone will create a repo, I can add some basic information to it and try to write a spec draft.

ljharb commented 5 years ago

cc @domenic @brendaneich

(but i imagine if you create your own repo and set it up, we could transfer that in easily enough, and the champions would appreciate it)

ORESoftware commented 5 years ago

Looking at the link, as far as aesthetics

let f = () => * {}

whoa. why not:

let f = *() => {}

but with a single param it might get weird:

let f = *a => {}
let f = *(a,b) => {}
khaosdoctor commented 5 years ago

Looking at the link, as far as aesthetics

let f = () => * {}

whoa. why not:

let f = *() => {}

but with a single param it might get weird:

let f = *a => {}
let f = *(a,b) => {}

I actually think *() => {} or *a => {} looks better than the first one, or even ()* => {} and a* => {} and (a,b)* => {} (just to match function *). It is, in my opinion, much more aesthetic and also follow the current function* guidelines.

ljharb commented 5 years ago

Let’s please save discussion of the proposal for its repo once it exists :-)

benjamn commented 5 years ago

You can mark this comment as off-topic too, but I don't want us to forget the possibility of introducing a new =*> token for this, since that would be totally unambiguous, and hasn't been mentioned elsewhere (as far as I can see/remember).

simonwep commented 5 years ago

This issue could also just transferred to the final repo (if it get's opened), so we can keep the comments.

And since the generator-function syntax got their star just after the keyword

function* name([param[, param[, ... param]]]) {
   statements 
}

i'd also vote for @ORESoftware 's *() => {}, wouldn't be that big of a change. And putting a star in the middle of the arrow looks a little bit confusing IMO :suspect:

benjamn commented 5 years ago

It seems risky/distracting to judge aesthetics without first limiting the pool of options to just the ones that have no parsing ambiguities. The last time TC39 discussed this proposal, almost every option was potentially ambiguous, so we need to tread extra carefully here.

chicoxyzzy commented 5 years ago

Notes from September 2016 TC39 meeting (@benjamn =*> was discussed there) https://github.com/tc39/tc39-notes/blob/master/meetings/2016-09/sept-27.md#11ic-generator-arrow-functions https://github.com/tc39/tc39-notes/blob/master/meetings/2016-09/sept-29.md#arrow-generator-revisit

This discussion is really important, though I agree with @ljharb, we need to move it to proposal repo. I'll post a link to it here later.

chicoxyzzy commented 4 years ago

Repo: https://github.com/chicoxyzzy/proposal-generator-arrow-functions Syntax discussion: https://github.com/chicoxyzzy/proposal-generator-arrow-functions/issues/2

I'm not sure that I can transfer this issue to my personal repo though.

ljharb commented 4 years ago

@chicoxyzzy once the proposal repo is in the tc39 org, we can transfer the issue.

chicoxyzzy commented 4 years ago

Is it possible to transfer separate messages? Otherwise I think that we can just close this issue in favor of chicoxyzzy/proposal-generator-arrow-functions#2

ljharb commented 4 years ago

No. This should be closed, since the repo's created, but I think we should still transfer the issue in the future.