| ▲ | vbezhenar 6 hours ago |
| It is especially weird because JavaScript was not supposed to be processed at all! This is all wrong if you ask me. Web development should strive to launch unchanged sources in the browser. TypeScript also was specifically designed so engine could strip types and execute result code. These build tools should not exist in the first place. |
|
| ▲ | azangru 2 hours ago | parent | next [-] |
| > TypeScript also was specifically designed so engine could strip types and execute result code. These build tools should not exist in the first place. Was it? Have you forgotten namespaces and enums? |
| |
| ▲ | MrJohz an hour ago | parent [-] | | More recently, it's been designed so this is the case. Namespaces, enums, and the property constructor shortcut thing were all added relatively early on, before the philosophy of "just JS + types" had been fully defined. These days, TypeScript will only add new features if they are either JavaScript features that have reached consensus (stage 3 iirc), or exist at the type system only. There have been attempts to add type hints directly to JavaScript, so that you really could run something like TypeScript in the browser directly (with the types being automatically stripped out), but this causes a lot of additional parsing complexity and so nothing's really come of it yet. There's also the question of how useful it would even be in the end, given you can get much the same effect by using TypeScript's JSDoc-based annotations instead of `.ts` files, if you really need to be able to run your source code directly. |
|
|
| ▲ | __alexs 6 hours ago | parent | prev | next [-] |
| JavaScript was not supposed to a lot of things. |
| |
| ▲ | Aldipower 3 hours ago | parent | next [-] | | Steve Jobs decided differently when he hated on ActionScript. 10 years ago this sentence probably would have start a flame war. ;-) | | |
| ▲ | brookst 3 hours ago | parent [-] | | Jobs’ complaint wasn’t actionscript the language, it was the security and performance nightmare of the Flash runtime. Though it’s hard to imagine what the web would look like if the language had become the standard. JS is a pain but AS was even less suitable for general purpose compute. | | |
| ▲ | Aldipower an hour ago | parent [-] | | And at least the "performance nightmare" is an irony from today's perspective as the Flash player wasn't actually slow at all! It was the incapability of the Safari browser to handle plugins in a good way and on mobile devices. Today's implementations of mobile application, JavaScript heavy applications and websites are much much more performance heavy. ActionScript3 was a very suitable language. |
|
| |
| ▲ | dschu 5 hours ago | parent | prev [-] | | And yet it pays my bills for almost two decades. | | |
|
|
| ▲ | olmo23 6 hours ago | parent | prev | next [-] |
| If you're already passing over the sources to strip the types, why would you also not do tree-shaking and minifications? |
| |
| ▲ | ZiiS 5 hours ago | parent [-] | | Why would I want to strip my types? | | |
| ▲ | wildpeaks 4 hours ago | parent | next [-] | | Because it's a waste of bandwidth if they're not enforced at runtime, the same reason why minification exists. | | |
| ▲ | ZiiS 4 hours ago | parent [-] | | Both not minifying and including unenforced type hints consumes a little bandwidth though this can be largely offset by compression. This is an engineering trade off against the complexity of getting source maps working reliably for debugging and alerting.
If I am shipping a video player or an internal company dashboard how much of my time is that bandwidth worth? |
| |
| ▲ | dminik 3 hours ago | parent | prev | next [-] | | Maybe because TypeScript is not valid JavaScript (yet)? If you don't strip types, your code doesn't work. | | |
| ▲ | wildpeaks 2 hours ago | parent [-] | | It depends on the runtime: Node can run Typescript because it automatically strips types (which is so convenient during development). But in browser, for now only the more limited JSDoc-style types can be shipped as-is indeed. |
| |
| ▲ | 1dom 4 hours ago | parent | prev [-] | | This feels like a ridiculous thread that captures everything wrong with modern Javascript ecosystem. It's grown into a product of cults and attempted zingers rather than pragmatic or sensible technical discussions about what we should and shouldn't expect to be able to do with an individual programming language. edit: to clarify, I assume there needs to be a basical level of comprehension of programming languages to debate the nuance of one, and if you can't think of a single reason as to why someone would want types removed, that's a possible indicator you don't have that necessary level yet, and I think the most effective way for you to learn that is to Google it. Sorry for coming across as rude if you genuinely don't know this stuff. If you already know many reasons as to why types would be removed, then it seems disingenuous to ask that question, other than to make the point that you feel types shouldn't be stripped. If you think that, say it, and explain why you think they shouldn't be stripped. | | |
| ▲ | ZiiS 4 hours ago | parent | next [-] | | The current state of Javascript is you _have_ to remove types; I was pointing out I can think of reasons why I sometimes wouldn't want to. (Admittedly in a glib manor; though on this site many prefer that to four paragraphs) | |
| ▲ | pestatije 4 hours ago | parent | prev [-] | | How goes that saying?... always assume ignorance or malice will getcha |
|
|
|
|
| ▲ | mexicocitinluez 2 hours ago | parent | prev | next [-] |
| > It is especially weird because JavaScript was not supposed to be processed at all! This is all wrong if you ask me. You're not actually suggesting that technology can't evolve are you? Especially one whose original design goals were to process basic forms and are now being used to build full-blown apps? It's absolutely wild to me that with everything that has happened in the last 2 decades with regard to the web there are still people who refuse to accept that it's changed. We are building far bigger and more complex applications with JavaScript. What would you propose instead? |
|
| ▲ | k4rnaj1k 6 hours ago | parent | prev [-] |
| [dead] |