Async/Await in Script: How We Built a Modern Async Runtime on Top of Tokio
docs.script-lang.org·3d
Preview
Report Post

Script now has full async/await support, built on top of Tokio—Rust’s production-grade async runtime. This post dives into how we implemented Promises, the await opcode, and bridged Rust’s async world with Script’s VM.

The Goal

JavaScript’s async/await is one of its most important features. It makes asynchronous code readable and maintainable:

// Instead of callback hell:fetchData((err, data) => {    if (err) return;    processData(data, (err, result) => {        if (err) return;        saveResult(result, () => {            console.log("Done!");        });    });});// We get clean async/await:async function workflow() {    const data = await fetchData();    const result = await processData(data);    await saveResult(result);    consol...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help