News for hackers. Stuff that matters.
Re:CPython's main branch running in the browser with WebAsse... by 999900000999 on Monday November 29, 2021 @12:11AM (#29376629)
I want Python to be used the same way JS is used. As in a native 3.7 interrupter in Chrome
Re:CPython's main branch running in the browser with WebAsse... by edgyquant on Monday November 29, 2021 @12:19AM (#29376679)
I don’t see how that could be done without nerfing a lot of the power of JS. JS was bred by the web and is entirely async. Python has no concept of callbacks or promises etc. JS is perfect for frontend design because that’s what it was created from the ground up for
Re:CPython's main branch running in the browser with WebAsse... by ekimekim on Monday November 29, 2021 @12:27AM (#29376727)
Python has always had the ability to do callbacks (ie. first class functions), though admittedly it's not a common pattern and the stdlib doesn't support it for IO (also its anonymous function syntax is poor).

There have been several libraries that provide the concept of a promise, but with modern python these are built into the stdlib with native async/await support, though many interfaces are still sync-only (though you can work around that with things like gevent that monkey-patch those interfaces to work with an event loop under the hood).

I agree that python would be a poor fit for the kind of uses that JS in the browser usually serve, but it's really a matter of ecosystem, not core language design.

Re:CPython's main branch running in the browser with WebAsse... by 999900000999 on Monday November 29, 2021 @12:21AM (#29376694)
Python would be optional here.

You could still use JS while Python support catches up.