Live data from Hacker News

Should JavaScript be split into two languages?

devclass.com

61–70 of 324 posts

Re: Should JavaScript be split into two languages?

#61
post #20

All this championing Javascript as a single language for front and back end work, now to be split for different use cases. Hopefully this is how Javascript dies if that is the route Google pushes it. There is already too much exhaustion around switching frameworks and paradigms in the JS world, but I guess everyone likes getting jerked around by corpos and evangelists these days.

We’ve run React for almost a decade now and the only major parts we’ve swapped have been react build with Vite. Angular has been even more stable since the switch to TS. As far as the frontend frameworks themselves changing massively, that’s a different story, but it’s not like C# didn’t go from Windows .Net to Core/Framework to cross platform .Net, and so on for different language frameworks. On the Backend there ar…

I’m not chasing down hypes and fads, the new product person who wants to make a splash by rewriting the core app does.

This is an incredibly disingenuous response. You maybe like the world this way. It doesn’t mean there isn’t room for change or improvement away from Javascript.

Re: Should JavaScript be split into two languages?

#62
post #51

All this championing Javascript as a single language for front and back end work, now to be split for different use cases. Hopefully this is how Javascript dies if that is the route Google pushes it. There is already too much exhaustion around switching frameworks and paradigms in the JS world, but I guess everyone likes getting jerked around by corpos and evangelists these days.

I’m really tired of this discourse. The JavaScript ecosystem is the lingua franca of the web. Furthermore, while a segment of the programming community has sat around complaining, JavaScript has gotten really good and continues to improve every passing year. Incremental progress is the key to making progress, not giant paradigm shifts.

Well drink a cup of java because it’s not going away.

Re: Should JavaScript be split into two languages?

#63
post #49
post #11

It's a good idea, but a better idea would be to make the browser a virtual machine running wasm. HTML, SVG and everything else could be implemented in wasm, and loaded from the cloud as needed.

WASM is slower than running JavaScript on V8 in almost all scenarios and will likely continue to be for a very long time. Also, many of us don’t want a compile step.

No, wasm has higher performance and lower memory usage. Here are two practical, real world examples:

https://www.amazon.science/blog/how-prime-video-updates-its-...

https://web.dev/case-studies/google-sheets-wasmgc

Re: Should JavaScript be split into two languages?

#64
post #45
post #16

Earlier quoted context omitted.

With the right debugging tools, transpiled alternatives to JavaScript are easier to debug than vanilla ES5. For example: TypeScript's sourceMap [1], Elm's time-travelling debugger [2], Vue.js DevTools [3], just to name a few I've tried. Especially well-typed languages tend to behave well at run-time once they pass type-checking. Or rather, I have not made enough front-end code to discover transpiler bugs. [1]: https:…

> transpiled alternatives to JavaScript are easier to debug than vanilla ES5 As easy, certainly. But how are they easier?

Because debugging better languages affords you more context and more tooling.

Elm's debugger lets you step forwards and backwards in the application's state.

TypeScript's type system lets you catch bugs before you run the code.

Vue.js's DevTools extend the browser's with a component-based overview, so you can interactively see what's going on at a high level of abstraction. (I'm sure something similar exists for most frameworks similar to Vue.js, and possibly even frameworks made in vanilla ES5, I'm just picking one I've tried.)

With vanilla ES5 you get interactive debugging.

Re: Should JavaScript be split into two languages?

#65
post #16

Earlier quoted context omitted.

With the right debugging tools, transpiled alternatives to JavaScript are easier to debug than vanilla ES5. For example: TypeScript's sourceMap [1], Elm's time-travelling debugger [2], Vue.js DevTools [3], just to name a few I've tried. Especially well-typed languages tend to behave well at run-time once they pass type-checking. Or rather, I have not made enough front-end code to discover transpiler bugs. [1]: https:…

> With the right debugging tools, transpiled alternatives to JavaScript are easier to debug than vanilla ES5. So if I agree with GP then I just haven't found the right tooling yet?

If you're happy writing ES5, power to you.

Re: Should JavaScript be split into two languages?

#66

Sounds like the presenters are assuming that everyone must be using JS in the same way they are. As someone who prefers to work in VanillaJS, I'm already frustrated by all the language changes being forced upon me. So maybe I agree with them that fewer changes should be made, but for completely different reasons. I'd rather them work on API improvements so that web apps get closer to parity with native apps. All this…

I think the proposal is actually good for people like you.

You can choose to just work with the core and maybe a minimal sugar library. Which will probably be faster and don't include "all the language features that were forced upon you".

Re: Should JavaScript be split into two languages?

#67

One of the examples given makes sense, since Symbol.specie messes with prototypical inheritance and is likely hard to secure as a result because that touches so much of JS as a whole. BigInt failing to materialize I think has more to do with ergonomics around it, they’re a bit unwieldy and there aren’t able to be used with the built in Math object functions. They also have zero JSON support out of the box which is a…

Can't replace Number with BigInt as BigInt is orders of magnitude slower on certain operations. Try to do bitwise operations with BigInt, you'll see what I mean.

Hence roadmapped. You can’t today, certainly, it also can’t represent floating point numbers or be used with the Math object as noted.

But the idea is that it should have been proposed with a roadmap of what it would look like to have it eventually supplant Number

Re: Should JavaScript be split into two languages?

#69
post #8
post #5

Earlier quoted context omitted.

good point. in a sense webassembly is that minimal very performant language. let javascript and typescript compile to webassembly, and you essentially got what is being proposed here

WebAssembly could replace JavaScript, the assembly language, once it has reached feature parity. But there's still far to go. Large parts of the browser API are still not directly available in WASM. I very much look forward to WASM reaching stability. It's very enjoyable to run Rust code in the browser.

What parts are not available?

WebAssembly can call arbitrary JavaScript through imports. You could literally provide an `eval` function if you were motivated to.

Re: Should JavaScript be split into two languages?

#70

I'd argue that other languages did this (or something similar) to great success, most notably Java. That is, the Hotspot VM was such a phenomenal engine that lots of other languages sprung up to take advantage of that: Closure, Scala, Kotlin, etc.: https://en.m.wikipedia.org/wiki/List_of_JVM_languages . Even with the Java language itself, syntactic changes happen much more frequently than VM-level bytecode changes. W…

It seems to me that wasm should just support the web/browser API instead of the current trampoline business; this way, JS build tooling can emit wasm files, which is similar to the example you use.

"trampoline business"?

It supports nearly arbitrary imports of anything you want. How much more flexibility do you need? You could provide an `eval` function to run arbitrary code with a small amount of effort.

Is the problem that Emscripten and/or Rust haven't laid it all out on a platter?

Post reply on HN