4 ms·
Javascript has plenty of terrible language features, particularly in the scoping rules, but the biggest problem is the lack of any concept of modules/packages,
by kyllo 13y ago
Javascript has plenty of terrible language features, particularly in the scoping rules, but the biggest problem is the lack of any concept of modules/packages, or namespaces. <script> tags just dump everything into the current page context. So you get stupid issues like name conflicts between all the different libraries that define a "$" function. Refresh the page or navigate to a new page and the context gets wiped out, so you have to store state in cookies to mimic the concept of a session. The 'Back' button often breaks everything. The whole platform was just designed for rendering simple documents and forms, not complex applications. The deficiencies of HTML/CSS/JS are why stuff like ActiveX, Flash, and now PNaCl even exist. They are workarounds, but they are proprietary and break portability, so they are not the way forward.
Yeah, you can make some pretty amazing applications with HTML/CSS/JS, but it's unnecessarily hard, you have to fight against the platform constantly, and the only reason why we do it is because we currently have no good alternative. Don't let the status quo blind you to the possibilities of how much better portable networked applications could be.
- SimeVidas 13y agoECMAScript 6 modules: http://www.2ality.com/2013/11/es6-modules-browsers.html http://www.2ality.com/2013/11/es6-modules-browsers.html. The JavaScript language is evolving and the issues you mentioned have been addressed.