4 ms·
The async transparency stuff is really interesting, and reminds me of a comment[1] I made a couple of years ago here on HN about async/await and how I think it'
by mstade 5y ago
The async transparency stuff is really interesting, and reminds me of a comment[1] I made a couple of years ago here on HN about async/await and how I think it's backwards from what it ought to be. Really glad to see you exploring this further, I think you're on to something.
That post from Bob Nystrom's blog makes the point I was trying to make much more eloquently than I could, thanks for sharing!
[1]: https://news.ycombinator.com/item?id=21065806 https://news.ycombinator.com/item?id=21065806
- recursivedoubts 5y agoYeah, it's really annoying that if you want to introduce some async behaviour in a function, you end up having to deal with it at all the call sites In the intro section I walk through adding a fetch to some code that jams text into a button and you can see how you don't end up having to change your code to do it: you just write the normal linear code with a fetch command in it: https://hyperscript.org/docs/#introduction https://hyperscript.org/docs/#introduction <button class='btn primary' _="on click fetch /clickedMessage then transition opacity to 0 put the result into me then transition opacity to 1 wait 2s then transition opacity to 0 put 'Click Me!' into me then transition opacity to 1"> Click Me! </button> The fetch, wait and transition commands are asynchronous (in javascript terms) but to hyperscript it's all just linear code.