A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Wait (function)

Cristian_Lorenzetto
2017-02-20

Wait is aparticular function when interpreter is entering in it flag the main block code . When is exiting unflag the block code. The main black code is blocked until the flag is unabled. No particular template or complex structure in js not very usable but a simple signal/wait.

Garbee
2017-02-20

How would this differ from the existing async/await functionality?

Cristian_Lorenzetto
2017-02-20

It is similar but I don’t understand for what reason add async when the interpreter can understand automatically when inside is used await

phistuck
2017-02-21

Blocking the main thread blocks the entire tab (in browsers). The user cannot interact with the tab at all. This is usually not what you want to happen.

Actually, it can block multiple tabs, if they are related, like window.open for the same origin. And in browser implementations of multiple-process-user-agents, it may block unrelated tabs that happen to share the same process.

This is pretty harmful.

Cristian_Lorenzetto
2017-02-21

no you dont undertand. it works also await function. But ASYNC is absololutely useless. ASYNC keywork is USELESS.

phistuck
2017-02-21

Your reply is really unclear to me, sorry. I do not understand what you are trying to convey.

Cristian_Lorenzetto
2017-02-21

:slight_smile: I write simply that functional logic is the same . it is a wait, it wait for a async result. But is the way to implement it that is wrong. Actually is use async keyword wrapping … but why? for realizing a so native function based on all OS you use complex adt as templates, … it is a simple wait!!!

No async keyword is necessary in the code. Why add that keyword confusing developers for no real need? Sincerelly i dont understand if who design new html5 proposals is a developer and a sotware architect or just a functional analizer. it seams the second one.

phistuck
2017-02-21

I am still not sure I understand…

async and await are just syntactic sugar for promise usage.

What exactly are you proposing here? Can you include some sample code for your proposal (and not just Wait())?

DanielHerr
2017-02-21

The async keyword indicates that the function automatically returns a promise. It also provides backward compatibility, as someone could have created an await function before async/await which would break when await support was added.

Also, HTML5 is unrelated to async/await. ECMAScript is the language standard.

Cristian_Lorenzetto
2017-02-21

it is necessary to add a keyword for granting function returns a promise. For a language not typized ? boh :slight_smile: Ok now i know who is responsable for async keyword that i hate :slight_smile: ecmascript not html5 :slight_smile:

bohhh, ok it create automatically a promise for a code not async as a main.

DanielHerr
2017-02-21

No, it is not necessary to use async to return a promise, it is syntactic sugar to do so easier. These two functions both return a promise.

async function() { }

function() {
 return(new Promise(function(){

 }))
}