Live data from Hacker News

Should JavaScript be split into two languages?

devclass.com

191–200 of 324 posts

Re: Should JavaScript be split into two languages?

#191
post #14

Earlier quoted context omitted.

This is mostly a solved problem in regular compilers, and sourcemaps etc do currently exist for JS. I agree that the tooling/UI around this could be better, but by focusing on this approach, things like Typescript get better as well.

Are there debuggers that can single step over the transpiled bits so that it feels like the methods are implemented natively? Otherwise, it becomes a mess.

I’m not sure if it exists, but it definitely seems doable (a regular debugger has to map instructions to lines of code).

If the browser starts treating JS as assembly, then there would probably be a greater onus for features like this.

Re: Should JavaScript be split into two languages?

#192
Imagine Google not having the resources to maintain their V8 engine after the hiring downturn, and telling us they want to change JavaScript because their V8 engine has become challenging to maintain.

A proposal rooted in attempts to improve the language would be one thing. This appears to be about Google struggling with technical competencies and not having the budget to do the right thing.

“A Google engineer presented … JavaScript VMs (virtual machines), they say, are “already very complex because of pressure to be fast,” which compromises security, and “feels especially bad” when new features do not get adoption.“

“The foundational technology of JavaScript should be simple, according to the proposal, because security flaws and the “complexity cost” of the runtimes affects billions of uses, whereas the benefits are restricted to developers and applications that actually use that complexity to advantage.”

Maybe try something besides c++ for V8 if you are having security issues?

The apathy towards proper tail calls in V8 leads me to distrust Google’s language proposals. But now that abdication appears to possibly have been a canary? Perhaps even prior to the pandemic they couldn’t keep up with maintaining the V8 C++ codebase, and that’s why PTCs got skipped?

By the way, what happened to Golang and Dart?

Re: Should JavaScript be split into two languages?

#193
post #170
post #96

Earlier quoted context omitted.

Previously you said: > [...] go through the javascript host, which is slow And now you admit: > this is going beyond my level of experience [...] > how much slower, i don't know I guess people just repeat what they hear without questioning or understanding it, and then it becomes dogma. > did you mean there are snappy webapplications running in WASM? No. I meant that all existing web apps go through the "javascript h…

you are not answering my question. most existing webapps are not running inside WASM. i am only talking about webapps running inside WASM. are there any WASM based webapps that are as fast as pure js webapps?

> you are not answering my question

Lol, your question asked me what I meant. I told you what I meant.

> are there any WASM based webapps that are as fast as pure js webapps?

You can browse links from Google for examples and benchmarks. Maybe one of these will scratch your itch, but I won't vouch for any of them:

https://madewithwebassembly.com/

But really, JavaScript and WebAssembly are both very fast. I don't think speed is the reason to choose one or the other.

For me, I like WebAssembly because it lets me program in languages other than JavaScript. JavaScript makes me want to scratch my eyes out.

Re: Should JavaScript be split into two languages?

#194
post #189
post #172

Earlier quoted context omitted.

Could you link an ergonomic example? I have cemented in my memory that DOM access in WebAssembly is not trivial and I suspect others too. This is what StackOverflow tells me (2020): > Unfortunately, the DOM can only be accessed within the browser's main JavaScript thread. Service Workers, Web Workers, and Web Assembly modules would not have DOM access. The closest manipulation you'll get from WASM is to manipulate st…

> This is what StackOverflow tells me (2020) Web Workers can't directly access the DOM in JavaScript either. This is not a WebAssembly problem. If you want a Web Worker to manipulate your document, you're going to post events back and forth to the main thread, and Web Assembly could call imported functions to do that too. I don't even know what he's on about with Preact/React... Save the following as "ergonomic.html"…

Is this sarcasm I might be missing?

Thanks for confirming that WebAssembly still cannot manipulate DOM in 2024.

It can only call custom javascript functions that manipulate DOM AND I need to write some arcane function signature language for every DOM manipulating function I want to call.

I'll give another 4 years and see if they fixed this.

Re: Should JavaScript be split into two languages?

#195
post #194
post #189

Earlier quoted context omitted.

> This is what StackOverflow tells me (2020) Web Workers can't directly access the DOM in JavaScript either. This is not a WebAssembly problem. If you want a Web Worker to manipulate your document, you're going to post events back and forth to the main thread, and Web Assembly could call imported functions to do that too. I don't even know what he's on about with Preact/React... Save the following as "ergonomic.html"…

Is this sarcasm I might be missing? Thanks for confirming that WebAssembly still cannot manipulate DOM in 2024. It can only call custom javascript functions that manipulate DOM AND I need to write some arcane function signature language for every DOM manipulating function I want to call. I'll give another 4 years and see if they fixed this.

> I need to write some arcane function signature language for every DOM manipulating function

You really don't know that you can create WebAssembly in other languages?!? I used WAT to keep the example short, but that's clearly lost on you.

> I'll give another 4 years and see if they fixed this.

In that time, there are lot of things you could be learning. Embracing ignorance and belligerence isn't like to serve you well in the long term.

Re: Should JavaScript be split into two languages?

#196
post #154

Earlier quoted context omitted.

Interesting. I did assess the ES6 coverage of ~97% a month ago. I just evaluated that while it sounds high, 3% of people is a lot of people to cut off if your JavaScript is essential. E.g. Firefox sits at ~2.7% browser market share. (Not incidentally the part that doesn't support ES6, but it's a demography the size of my own.)

> 3% of people is a lot of people to cut off if your JavaScript is essential These are probably the 3% that won’t affect your business much. They’re more likely to be on older hardware and also have less discretionary income. Or browsing on really weird hardware that is also unlikely to lead to a sale.

People with "less discretionary income" still deserve to access the web in a way that isn't broken. This might come as a surprise nowadays, but the web can be useful for more than just selling things.

Re: Should JavaScript be split into two languages?

#197
post #105
post #40

Earlier quoted context omitted.

asm.js came about because Mozzilla refused to adopt PNaCL, which is kind of ironic given the existing Firefox market share a decade later.

PNaCL was essentially "let's shove LLVM into every browser and make it a mandatory part of the web", which somehow seems even worse than "let's shove the JVM into every browser and make it a mandatory part of web"

>"let's shove the JVM into every browser and make it a mandatory part of web"

Javagator / Jazilla!

https://www.cnet.com/tech/tech-industry/javagator-down-not-o...

Re: Should JavaScript be split into two languages?

#198
post #195
post #194

Earlier quoted context omitted.

Is this sarcasm I might be missing? Thanks for confirming that WebAssembly still cannot manipulate DOM in 2024. It can only call custom javascript functions that manipulate DOM AND I need to write some arcane function signature language for every DOM manipulating function I want to call. I'll give another 4 years and see if they fixed this.

> I need to write some arcane function signature language for every DOM manipulating function You really don't know that you can create WebAssembly in other languages?!? I used WAT to keep the example short, but that's clearly lost on you. > I'll give another 4 years and see if they fixed this. In that time, there are lot of things you could be learning. Embracing ignorance and belligerence isn't like to serve you we…

[flagged]

Re: Should JavaScript be split into two languages?

#199

Earlier quoted context omitted.

But it's not as if security concerns are specific to the Web. Look at the vulnerabilities found in CPUs over the last decade or so. Security is necessary no matter what the delivery medium, so I don't see why this is a rationale for reinventing the wheel.

They genuinely spent years trying to make Java more secure for the web. That was entirely new effort.

And?

Re: Should JavaScript be split into two languages?

#200
post #195

Earlier quoted context omitted.

> I need to write some arcane function signature language for every DOM manipulating function You really don't know that you can create WebAssembly in other languages?!? I used WAT to keep the example short, but that's clearly lost on you. > I'll give another 4 years and see if they fixed this. In that time, there are lot of things you could be learning. Embracing ignorance and belligerence isn't like to serve you we…

[flagged]

> Thanks for your simple concrete examples and explanations!

I'm glad someone liked it :-)

> I love his description of Forth as "a weird backwards lisp with no parentheses"

I've been interested in that duality between Forth and Lisp before, but my progression always seems to following this path:

- Since Forth is just Lisp done backwards and without parens, and since it's not hard to write an sexpr parser, I might as well do Lisp to check the arity on function calls.

- But in addition to arity errors, I'd really like the compiler to catch my type errors too.

- And since I've never seen an attractive syntax for Lisp with types, I might as well have a real grammar...

And then I've talked myself out of Forth and Lisp! Oh well.

Post reply on HN