Hacker News new | ask | show | jobs
by Smaug123 1710 days ago
For more mind-blowing stuff, try learning F#, where async/await as a language feature is something you could implement entirely in user-space (though of course you need to access the .NET APIs if you want to implement parallelism). F# has "computation expressions", which allow you to define syntax for fully-general "monad-like things", and the built-in `async` computation expression is just a part of the standard library and is defined using that mechanism.

I imagine exposure to algebraic-effects systems must make one feel the same way: like it's such an awful hack when a language has to have async support baked into its syntax!

1 comments

FYI, OCaml also has library-level async/await implementations (e.g. Lwt), and something similar to computation expressions (let-operators).