4 ms·
The web environment was never intentionally designed to be what it has become (a system for drawing fully featured user interfaces and even games) and so isn't
by furi 8y ago
The web environment was never intentionally designed to be what it has become (a system for drawing fully featured user interfaces and even games) and so isn't really equipped for it, you could argue it's missing a lot of widget primitives, the view-updates-as-string-manipulation is archaic to put it kindly and the whole thing is untyped and shackled to a weak language without so much as a proper this keyword.
This environment is simultaneously so restrictive (in that you can't really introduce new languages except by having them transpile to JavaScript) and so bad that people end up trying to tie it into something more cohesive (React's virtual DOM, Typescript) and then only partly succeeding (React's dependence on setState and things often being much easier to do with document.getElementById than in the React way, Typescript's inability to handle libraries intended for the web), leading other people to try do it better.
- ng12 8y ago> Typescript's inability to handle libraries intended for the web Can you elaborate? TypeScript is incredibly popular for client-side development.
- furi 8y agoMaybe I missed something, but my experience was that Typescript was capable of making useful conclusions (i.e. MyLibrary.MyType.width exists, but MyLibrary.MyType.dog does not) about other libraries, delivered to it via NPM, that were also written in Typescript. If your libraries were written in JavaScript to be run in the browser you were stuck doing `declare var mylibrary: any;` and writing "unsafe" code. This is also true of any global variables/functions/etc. that exist in <script> tags in your HTML. To be clear I don't expect it to be able to do this, reading JavaScript that was written without types and deciding what the types are sounds more or less impossible, it's just a demonstration of how you tend to end up with an imperfect solution as a result of the decisions made early on in the web's development.
- jelgt2011 8y agoTypescript allows you to essentially write a typed API interface for your library (instead of rewriting your entire library in typescript), but support is fairly spotty.