Hacker News new | ask | show | jobs
by rtpg 1284 days ago
> What does this mean? Isn't JS blocking by default? Both languages have async support that you don't have to use...

To be clear on this, because JS APIs prioritize non-blocking mechanism to the expense of everything else (related to it the original sin of how JS interacts with a browser IMO), everything has to become async, even though in practice a lot of this stuff is happening sequentially anyways.

See this example Playwright test [0]. awaits everywhere. Because of how await works as well (Rust got this one right with postfix await), suddenly fluent APIs become awkward. You no longer have foo.bar().baz() but (await foo.bar()).baz(). (await getResources()).map(f) is not beautiful in my eyes.

And the core thing is that almost no code actually relies on concurrency in practice! So much of this is a consequence of the problem of JS not having good yielding semantics, and its interaction with the DOM in general.

Is this the biggest issue in the world? I guess not, but I very much dislike the aesthetics of this fore smaller chunks of code. I would really like a model with implicit awaiting in ~all the places that it exists currently.

I do agree that JS's anonymous function syntax is nice, and I miss it dearly in Python. Though here as well, I think Python comes up on top with all of its argument/keyword argument strategies. I get the options dictionary pattern, but dislike it.

And UI stuff is of course ... well it's easier in Javascript (though it requires its own infrastructure). There's no ways around that.

Loads of serious work is done in both language, I just think that JS is missing a lot of table stakes features given that there's so much attention to it.

[0]: https://playwright.dev/docs/writing-tests#the-example-test