> Global variables are not a problem (far more of an issue for incompetent programmers)
They will be if you have no form of seperation of code and you're including lots of libraries from npmjs all with dependencies
It's the reason CommonJS was invented as a way of namespacing / seperating code, now ESM has replaced it and has just recently made it's way into modern browsers
> Your problem is that you want a Java like language.
Personally I think Java is pretty dire, but I understand where you're coming from I think you mean more of an Application language rather than just scripting.
Early JS didn't have a lot to work with when it came to browser API's so it gained a reputation for being massivly overbloated for anything fancy.
Over the last couple of decades or so browsers have been adding in more and more API's so that JS can be used this way without it being slow and bloaty
> The real flaws in JS are not often discussed by the kiddies who learned Java in school and can't handle C++.
Personally I think the earliest code I wrote was on the ZX Spectrum.
C++ is pretty horrible to write for, the syntax is horrible due to it being invented during the days of pre-internet and trying to be an extension of C.
It's build system is horrible (not very portable) it's library management for build time libs is pretty much non existant, runtime libs are typically handled by OS package management so that's ok.
It's filled with macros which change between projects to get around the fact no one platform can agree on the size of an integer.
It's not a "managed" language, in that you have to manage the garbage collection.
Java is pretty horrible too (it's namespaces are far too long and it's lack of standardisation for libs is another issue).
But it was the first of it's kind I think when it came to JIT and led to better languages later on.
> If you want a native-like app and the JS+ WebAsm components lacking native-like access is not good enough for you or your app-- then you should just make a native app and leave the browsers alone.
Ok show me a cross platform way of writing a UI app that has
* Cross platform capability - i.e. Linux / Windows / Mac / Mobile / Android / IOS
* Has thousands of libs available - https://www.npmjs.com/
* Doesn't require any user input in terms of install, and is just available from a single web link
* Is easy to write for (no C++ or Java thankyou)
* No need to manage garbage collection
* Can be statically typed if you want it to be (Typescript)
The closest you'll find to something like that is possibly Qt and that's limited to C++ / python the last time I checked.
There is a demand for cross platform user interfaces that just work and are "convenient"
convenient being the stand out word here, where you're grandpa can just log onto his bank account without having to install anything.
Most of the development towards fancy UI is currently heading in the JS direction.
In that it seems to appeal to the artsy types (I'm more of a backend type myself).
Unfortunatley this does lead to lots of people all trying to re-invent the wheel to get some measure of fame
(JS has a lots and lots of re-invented wheels)
Electron was the first of it's kind to try and develop a desktop app that used JS as a UI in the desktop.
Unfornatley it was a bloated mess since it was basically bundling an entire copy of the chrome browser on disk and in memory for each app.
Looking ahead Microsoft recently invented something called WebView2 which basically strips out all the browser junk and gives you the ability to have desktop apps that can use all the JS libs from npmjs
Without all the memory / disk bloat, it's something now included as part of windows 11 by default.
In this sense JS is / has been moving more towards a designer / UI set of libraries and code for general purpose front ends.
This is why I said webassembly will be the next thing in so far as manipulating the DOM, it'll be the same as JIT.
So for example
C# -> IL (cross platform assembly) -> Native code (compiled / run on the fly)
JS / Typescript / etc -> WebAssembly (cross platform assembly) -> Native code (compiled / run on the fly)
Pretty much the same thing.