Live data from Hacker News

Should JavaScript be split into two languages?

devclass.com

261–270 of 324 posts

Re: Should JavaScript be split into two languages?

#261
post #140

Earlier quoted context omitted.

Or you can just draw to canvas to make the UI fast which is what Flutter does now: https://flutterweb-wasm.web.app/ https://www.youtube.com/watch?v=Nkjc9r0WDNo

So throwing out literally 99% of what makes the web actually portable and useful? A random drawn rectangle is not a UI, it’s not accessible, not inspectable, not part of the de facto OS native toolkit. If all we wanted is a random cross-platform canvas element to draw onto from a vm, it could be solved in a weekend. There are million examples of that.

> A random drawn rectangle is not a UI

Of course it is. All screen based user interfaces are blinking lights.

> it’s not accessible

It's best to read the documentation first. It's a low effort thing to do:

https://docs.flutter.dev/ui/accessibility-and-internationali...

Re: Should JavaScript be split into two languages?

#262
post #140

Earlier quoted context omitted.

So throwing out literally 99% of what makes the web actually portable and useful? A random drawn rectangle is not a UI, it’s not accessible, not inspectable, not part of the de facto OS native toolkit. If all we wanted is a random cross-platform canvas element to draw onto from a vm, it could be solved in a weekend. There are million examples of that.

> A random drawn rectangle is not a UI Of course it is. All screen based user interfaces are blinking lights. > it’s not accessible It's best to read the documentation first. It's a low effort thing to do: https://docs.flutter.dev/ui/accessibility-and-internationali...

Its web targeted version is still not accessible, even though they promised that they will actually render to HTML elements as much as possible. A single canvas element is not that.

Re: Should JavaScript be split into two languages?

#263

Earlier quoted context omitted.

Yeah but if I change jobs or work on another project then I’d have to learn two standards.

Did you read the article? The sugared JS would be a superset of the target JS. So you would only need to learn the sugared.

Need to learn both because I still need to know what is sugar in order to use the subset.

Re: Should JavaScript be split into two languages?

#264

Earlier quoted context omitted.

Work in a publicly traded company where people are moving things around for promotions sake. Then you’ll see how forced you are to use the latest flavor of the week. People absolutely do force you. It’s not just the flavor of the week frameworks, it’s libraries and best practices. Want to work with dates? Do you use moment? Nope that’s deprecated, what do you use? Which moment successor? How do you write react? Class…

> Work in a publicly traded company where people are moving things around for promotions sake. Then you’ll see how forced you are to use the latest flavor of the week. People absolutely do force you. I can tell you such stories about any language, it’s not unique to JS. Welcome to working with people.

Do not sit there and tell me Javascript hasn’t absolutely proliferated across the stack and that these problems don’t surface more. Just because ANYONE can introduce ANY framework of ANY language doesn’t meant that Javascript hasn’t championed a lot of those issues. You’re handwaving away my points for no good reason.

Re: Should JavaScript be split into two languages?

#265

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…

Java doesn't run in browsers so the comparison doesn't make sense.

Splitting the language might make sense from an engineering perspective but what about all the extra energy and bandwidth that will be needed?

Re: Should JavaScript be split into two languages?

#266
Just no.

Browsers operate at a scale never seen before. Imagine all the extra energy and bandwidth needed if core functionality is moved to the application code when you have billions of users.

What we need is more native functionality (implemented in the JS engine with C++ or Rust) to have as less user land code as possible.

As an example, imagine how much energy, bytes, and CPU would be saved if browsers and JS engines included reactivity and JSX. Or if browsers included an API similar to jQuery.

Quick math to grasp the scale: 100kb * 1 billion users = 100TB of data that needs to be transferred and parsed many times, every single day. It's absurd.

Re: Should JavaScript be split into two languages?

#267
post #238

Earlier quoted context omitted.

> I wasn't trying to draw attention to comparisons for equality. Perhaps I should've used an arrow => instead Then it's even less of issue. Yes if you convert to a float you get rounding, what did you expect when you introduced a float? It's somewhat unintuitive but that's the nature of floating point. > The real point is that you can get some non-intuitive answers from letting that numeric tower make conversion deci…

I think I can summarize your point of view as, "any use of floats should be treated as undefined behavior, so you get what you deserve." And that says nothing about whether implicit conversions are a good idea or not.

The specific type of conversion is one I don't see as a big issue. The programmer deliberately decided to use an imprecise data type for the calculation.

But more importantly, I'm saying that the problematic rounding can occur even if your tower does not have both bigint and float. It can happen even if every layer can completely represent every value of the layer above it. Do you have any complaints that are unique to a tower that has both bigint and float, and don't apply to towers that only have float?

To elaborate on that, an implicit cast directly from a single bigint to a single float won't happen with the rules in the wikipedia article. You'd have to do something like bigint+float, which can have horrible rounding errors, but those horrible rounding errors are also present in float+float.

And you can even have these problems without a tower. So I don't see how the bigint and float scenario is an argument against towers.

Re: Should JavaScript be split into two languages?

#268
post #117

Earlier quoted context omitted.

Did they solve GC and DOM access ? It's been years since it was "just about to happen" and I stopped paying attention in the meantime. But if it had that I agree - it would be ideal if JS was a legacy thing and a saner WASM first class language got to replace it. Keep the single threaded event loop approach but kill the JS semantics.

Actually I don't want DOM access and GC for wasm. At least not yet. It overcomplicates a lot and I simply cannot imagine that a GC can be one-size-fits-all languages. I want fixed-size buffer-backed structs for JS. Basically a DataView as a C struct. This would massively benefit interop and solve some shortcomings of DataView. There was a proposal for a binary AST for JS several years ago [1]. Why not just use that a…

Problem with AST is that it still kind of forces JS semantics which we should be working away from if we're doing this big leap.

Re: Should JavaScript be split into two languages?

#269
post #262

Earlier quoted context omitted.

> A random drawn rectangle is not a UI Of course it is. All screen based user interfaces are blinking lights. > it’s not accessible It's best to read the documentation first. It's a low effort thing to do: https://docs.flutter.dev/ui/accessibility-and-internationali...

Its web targeted version is still not accessible, even though they promised that they will actually render to HTML elements as much as possible. A single canvas element is not that.

If you're not going to read the documentation, read a blog post:

https://medium.com/flutter/accessibility-in-flutter-on-the-w...

Re: Should JavaScript be split into two languages?

#270
post #239

Earlier quoted context omitted.

> it’s just a standard s-expression syntax I.e. they are correct that it is arcane. What percentage of programmers today do you think have ever seen code written in any Lisp dialect, let alone understand it?

What percentage of programmers on Hacker News haven't? Flaunting your ignorant anti-intellectualism isn't a good look. You do know this is 2024, you have Internet access, and you can just look shit up or ask ChatGPT to learn new things, instead of cultivating ignorance and pointlessly criticising programmers trying to raise awareness, share their experiences, and educate themselves and other people. In case you've be…

Most devs do know what Lisp'ish languages are because you just can't forget how weird a bunch of nested parenthesis look.

They just don't care enough to invest time in it because it is niche. And proponents tend to tirelessly spam about it from their ivory towers like it's flawless and everyone who didn't learn it is somehow inferior, somehow justifying personal attacks like yours. Classy as usual.

Post reply on HN