Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allsync function #1686

Closed
Gurigraphics opened this issue Sep 4, 2019 · 10 comments
Closed

Allsync function #1686

Gurigraphics opened this issue Sep 4, 2019 · 10 comments
Labels
feature suggestion Please see https://github.com/tc39/ecma262/blob/HEAD/CONTRIBUTING.md#creating-a-new-proposal

Comments

@Gurigraphics
Copy link

Assumption:

async/await/promisses approachs seems that spread the treatment of complexity around the code.

Async function

const a = function(){  
  return new Promise(( resolve, reject ) async function(){ 
    let a = await getA()
    let b = await getB()  
    let c = await getC()
    let d = await getD()
    resolve( { a, b, c, d } )  
  }
}
let aa = await a()

That seems be more in agreement with single responsibility (or treatment ) principle:

Allsync function

const b = allsync function(){  
  let a = getDataA()  // = await getDataA()
  let b = getDataB() 
  let c = getDataC() 
  let d = getDataD() 
  return { a, b, c, d }  
} 
let bb = b() // = wait b()

It seems to make more defined what the function does and what it returns.
We don't await another result or behavior.
And we don't even have to indicate this everywhere.

@ljharb
Copy link
Member

ljharb commented Sep 4, 2019

Please see https://github.com/tc39/ecma262/blob/master/CONTRIBUTING.md#creating-a-new-proposal for the best way to suggest new features for the language.

@ljharb ljharb closed this as completed Sep 4, 2019
@ljharb ljharb added the feature suggestion Please see https://github.com/tc39/ecma262/blob/HEAD/CONTRIBUTING.md#creating-a-new-proposal label Sep 4, 2019
@Gurigraphics
Copy link
Author

Can you put as a discussion? I understand that before suggesting something is better discuss if this really makes sense.  And I consider here a appropriate place for this. Because it also be a critique of existing and in progress features.

@ljharb
Copy link
Member

ljharb commented Sep 4, 2019

This repo is not an appropriate place for discussion of new language features; that's what es-discuss and the discourse are for.

Critiques of in-progress features happen on each proposal's own repo. This repo is for handling issues with the specification itself.

@Gurigraphics
Copy link
Author

Gurigraphics commented Sep 4, 2019

(...) This repo is for handling issues with the specification itself.

Ok. I suggest then removing or rename this option in New issue:
Feature request

@ljharb
Copy link
Member

ljharb commented Sep 4, 2019

When you click that option, there's three paragraphs of text - the second one is:

Feature requests for future versions of ECMAScript should not be made in this
repository. Instead, they are developed in separate GitHub repositories, which
are then merged into the main repository once they have received "Stage 4".

@Gurigraphics
Copy link
Author

I suggest:

Feature Requests and discussions about future versions of ECMAScript should not be made in this repository.

Continue with what you wrote...

Critiques of in-progress features happen on each proposal's own repo. This repo is (...)

@ljharb
Copy link
Member

ljharb commented Sep 4, 2019

Here's the current text in its entirety, which already contains your suggestion:

TC39 is open to accepting new feature requests for ECMAScript, referred to as
"proposals". Proposals go through a four-stage process which is documented in
the TC39 process document.

Feature requests for future versions of ECMAScript should not be made in this
repository. Instead, they are developed in separate GitHub repositories, which
are then merged into the main repository once they have received "Stage 4".

Please see CONTRIBUTING.md for more details.

I'd be happy to hear suggestions for how that could be made clearer.

@Gurigraphics
Copy link
Author

I'd be happy to hear suggestions for how that could be made clearer.

My opinion is that, with those two sentences in the first paragraph, it makes this clearer and can help to prevent this problem from recurring.

But if you prefer to assume that the atual text is excelente, and that the error is always from the user who has not read or not interpret properly, then ok ... Anyway, a suggestion is not an order.

@ljharb
Copy link
Member

ljharb commented Sep 4, 2019

A PR to the issue template would be welcome.

@Gurigraphics
Copy link
Author

Thanks: #1687

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature suggestion Please see https://github.com/tc39/ecma262/blob/HEAD/CONTRIBUTING.md#creating-a-new-proposal
Projects
None yet
Development

No branches or pull requests

2 participants