Hello guys,

It strikes me as an interesting development to see that the current 
definition of Async/Await (as I see it), is as simple syntactic sugar for 
.then().  While I, to an extent, see the point of such a command as being 
useful, I remain unaware of the exact reasoning why we need to include 
promises in the first place.  Wouldn't it be so much more powerful to be 
able to use completely normal syntax, as you would in synchronous code, 
instead of the awkwardness of Promises?

For example, take the following code snippet:

function asyncFunction() {
  return new Promise((resolve, reject) => {
    someAsync('data', (err, data) => {
      if (err) {
        reject(err); return;
      }
      resolve(data);
    });
  }); 
}


This seems to be so very confusing for anybody new studying this language, 
almost everyone I talk to gets stuck up on some part of it.  Wouldn't it be 
so very beautiful if we could just do:

function asyncFunction() {
        someAsync('data', (err, data) => {
                return [err, data]
        })
}


When we call this with the `await` keyword, we simply `await` a return.  No 
special promises or extra keywords needed, everything works as you would 
expect it to.

async function asyncFunction() {
        let [err, data] = await asyncFunction()
}


Honestly, are we just making life complicated for ourselves with utilising 
promises & await/async?  

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/a0d9de78-fe3e-48a9-883e-6587d9e84d9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to