6 ms·
Now if only we get a good web-oriented Python with a WASM backend, we'll finally be able to throw Javascript where it belongs: into the dustbin of history.
by LessDmesg 7y ago
Now if only we get a good web-oriented Python with a WASM backend, we'll finally be able to throw Javascript where it belongs: into the dustbin of history.
- janpot 7y agoHonest question, in what sense is python a so much better choice for web development? syntax? subjective, and it would also mean all C-likes belong in the dustbin. performance? Why would python, as a language, be significantly more performant? It's just as dynamic. ecosystem? JS community is huge, JS package managers are huge (even though not flawless, but nothing their python counterparts do better) I mean I can surely imagine there's better alternatives for JS, as a language. But python...?
- ShakataGaNai 7y agoNot Op, but I'd like to do python/WASM because I don't do want to do C-Like languages. Sometimes you want to do some light web interactivity without major mental context switching. For me, personally, it's a lot of effort to switch between languages. So when I'm building a web project and most of it is django/flask/python/etc, but I want something more dynamic than a HTML form post/browser reload... I need to do it in Javascript. Not that I can't javascript, I can, it's just hard to change over and I'm slow to write it. It would be a whole bunch nicer if I could just stay in the python mindset for those small pieces of code. Do I think python is "better" for the web? No. do I think it's faster? Doubt it. Do I think it's "better" for my use cases? Yes - And that's the power of WASM. It allows people to do what works for them.
- LessDmesg 7y agoFor one thing, not being broken. Python doesn't have ("1"+1) and similar design flaws, Python doesn't need a new ECMAscript standard every year, Python has figured out modules and classes much earlier, and frankly, Python is what Javascript is only becoming after years of improvement. Really, I don't understand why we and the browser maintainers have to put up with a broken, insane language when there is a similar but much more mature and "done right" one. And as far as ecosystem, Python can kick Javascript's ass if not in quantity (though it's close) then in quality of its userbase for sure. And Python has been used onе the backend much more than JS, so it makes much more sense to unify the language and just use Python for the front-end.
- wahern 7y ago> Python has figured out modules... much earlier, You expect that to carry over to WASM environments?
- strbean 7y agoI feel like almost every one of those points is highly debatable. - New ECMA standard every year VS. new PEPs every year - Modules and classes: cyclic dependency hell, obscure multi-import issues, __init__.py ugliness, imperative class declaration. Python only figured these things out much earlier to the extent that it has actually figured these things out. ...
- h8hawk 7y agoI think almost any thing is better than js. At least it is popular due to its actual developer's. People use it because they like it and its ecosystem was grown by them, not force of a dumb decision in 90's or company backup. Both performance and ecosystem are not characteristics of language. they are due to being the only language is being supported in browser. (hint: I won't use python for web) Also comparing languages based on syntax and ecosystem is not very clever idea.
- mark_thompson 7y agoWas going to ask in the main thread but perhaps here is a better place. For someone just starting with programming, but targetting WASM, which would be a good first programming language? Java? In my particular case, I've been learning Python for Data Analysis for about one year, and a few months of Haskell (love Haskell so far, but my interest/job is related to data analysis and web dev). I've heard bad things about Python as first programming lang (weakly typed and bad OOP implementation).
- shantly 7y agoSince Java relies on the JVM I think I'd avoid it, and any other languages that'd require running another VM on top of the WASM VM. Seems like useless stacking of technology that serves basically the same purpose. Not saying it wouldn't work and that it won't be done, but just seems kinda gross and missing-the-point. Personally I'd also avoid anything with a fatter runtime than maybe Go or C#. If it doesn't already, I'd expect C# and .net generally to have really good WASM support, actually. And even those, unless it becomes standard to ship their runtimes with a browser, you're talking about a pretty fat package to ship before the program can even start running. Most interpreted languages (like Python) running on WASM will probably be notably slower than Javascript running outside WASM, for the reason that they'll have similar limitations on optimizability, will have had fewer person-years put into optimization than Javascript (which has seen tons of investment from e.g. Google), and will be running on an interpreter in the WASM VM rather than a C++ (or whatever) native interpreter. And they'll have the problem of needing to ship an interpreter, similar to the runtime problems for the languages above. For the best experience you want something fast-loading and well-performing. That means small package size and not too deeply nested in terms of abstraction on top of WASM. If you want a better experience on both fronts than JS, which has the benefit of already having its interpreter bundled with the browser and running on a native, highly optimized interpreter—IOW if you want running on WASM to actually be a win in any meaningful UX way—you'll need to look at fairly low-level languages, I think. C++ is a good bet—people are quick to shit on it, but it remains hugely important in GUI application development—or, if you're wanting something hipper, Rust, perhaps. Go or .net-family languages might be OK, future-proof-ish choices if you don't mind sacrificing load time a bit. Toss Swift in that bucket too, I guess.
- avbor 7y agoMore work to be done, but Mozilla DID get Jupyter Notebook to run on the web with WASM. https://hacks.mozilla.org/2019/04/pyodide-bringing-the-scientific-python-stack-to-the-browser/ https://hacks.mozilla.org/2019/04/pyodide-bringing-the-scien...
- Jmanuldorf2019 7y agoThat's just replacing trash with rubbish.
- LessDmesg 7y agoWhat would you prefer then, Lua, with its 1-based arrays? Python is a mature, universal, versatile, insanely popular dynamic language with a nice syntax. It fits the bill perfectly.
- BubRoss 7y agoIf indexing arrays starting at 1 is a big problem, either the language is fantastic or you aren't challenging yourself. Programming gets a lot harder than that.
- root_axis 7y agoSomething with a static/strong type system.
- fastball 7y agoPython has static type checking now, and has always been strongly typed.
- LessDmesg 7y agoI'd like that too, but it's not going to work with the web dev populace. They're used to a dynamically-typed sandbox and won't switch to a full statically typed language.
- fastball 7y agoWhat about TypeScript?
- saagarjha 7y agoLua’s a great language; hating on it for 1-based indexing (it doesn’t have arrays) is somewhat petty.
- ww520 7y agoI'd pick Javascript over Python for frontend dev in any day. Python can't even do proper lambda.
- h8hawk 7y agoJust name it! Good luck with that.
- sunseb 7y agoI think in the end we may have a subset of JavaScript that compiles to WebAssembly. Something like TypeScript. Something that cleans up the mess of JS and keeps the good parts.
- deleted 7y ago[deleted]
- baja_blast 7y agoPython would be a bad choice for the web since it was not designed around events. JS was designed specifically to turn on top of a browser with an event loop to respond to events as they happen. Python would just make a slow non responsive browsing experience. Also WASM wasn't designed for "any languages goes" in mind, it was designed for lower level languages like C/Rust which have manual memory management to run high performance applications like games, and video editing tools etc. Also as someone who uses Python regularly, Python is by no means a perfect language. I am assuming you only know Python since it's an attitude I often come across for devs who only develop in Python and believe it's the superior to every language in every way.
- traverseda 7y agoPython wasn't designed around events, but using python-style async/await syntax under javascript has made my life a lot easier.