News for hackers. Stuff that matters.
Re:Porffor: A from-scratch ahead-of-time JS engine by frutiger on Wednesday July 31, 2024 @12:06AM (#41116337)
Not sure where you mean by synchronously but if you mean what I think you mean then that is not correct behaviour. This is important to ensure predicatibility.

Eg.

    Promise.then(() => console.log(“a”));
    console.log(“b”)
must log [“b”, “a”] and not [“a”, “b”].
Re:Porffor: A from-scratch ahead-of-time JS engine by canadahonk on Wednesday July 31, 2024 @05:20AM (#41117573)
This type of test does work as expected. The "sync" means that it does not feature a full event loop (yet) so cannot easily support async I/O or some more "advanced" use cases.
Re:Porffor: A from-scratch ahead-of-time JS engine by spankalee on Wednesday July 31, 2024 @11:02AM (#41119822)
There's a WASI async functions proposal I think? Are you looking at supporting that so you don't have to bring your own event loop?
Re:Porffor: A from-scratch ahead-of-time JS engine by cowsandmilk on Wednesday July 31, 2024 @05:43AM (#41117663)
JavaScript doesn’t make the guarantee you are claiming here
Re:Porffor: A from-scratch ahead-of-time JS engine by fwip on Wednesday July 31, 2024 @10:00AM (#41119239)
What do you mean? Does JavaScript allow the `then` of a promise to execute before the contents of the promise?
Re:Porffor: A from-scratch ahead-of-time JS engine by jitl on Wednesday July 31, 2024 @11:36AM (#41120126)
Yes, it does. Promise continuations always run in the micro task queue per the standard. I guess if someone mutates the promise prototype it’s not guaranteed, but the spec does guarantee this order