Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"deprecate-js" proposal #9

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions proposal/deprecate-js.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Intro
If you've seen [discussions about the "JS0/JS-Sugar" proposal](https://caolan.uk/notes/2024-10-14_js0_jssugar.cm), you're probably going to disagree with the proposal itself, at least in one way or another.
But I'd like to point out that there really are some good intentions behind it.

> The road to hell is paved with good intentions

Yes, that's sometimes true, but hear me out for a second. I have another proposal that might be better, or worse, or just as bad. You'll be the judge.

## Body
IMO, **JS should be deprecated**, at least as a web-standard, not deprecated as a language spec (ECMAScript should live for a while).

Don't get me wrong, I feel "comfortable" writing JS, and I like the fact that having a browser installed implies access to a cross-platform general-purpose Turing-complete programming-lang (nice!).

But **Wasm has a textual representation**, and Python is much better suited as a cross-platform scripting/programming lang, so why are we forcing browsers to implement JS? Because of _"legacy"_.

But who cares about legacy if there will be old browser versions (both in binary and source form) available for download?. Additionally, anyone can implement a non-optimized JS engine, to avoid the maintenance burden of Chromium, WebKit, Blink, Gecko, SpiderMonkey, etc...

**Anyone who actually cares enough will eventually do that**, and if there's enough people they can create a "Legacy Browsing Foundation".

Please excuse my ignorance if what I'm saying is "bogus". But it's objectively true that web standards (such as HTML) have cruft that has been accumulating since the 90s. I respect the commitment to compatibility, but I'm afraid we have gone too far down this hole.

### Wasm
I've seen [people in the comments](https://youtu.be/onCHSujPlfg) saying stuff like "WebAssembly requires JS", "Wasm is slow when using the DOM API", etc...

They got it backwards: If Wasm got enough attention, eventually the standards-body and browser-vendors will make it **independent from JS**. Unfortunately, this is a catch-22 situation.

If it happens, it would be huge (hype alert?). Imagine a world where you could do
```html
<script type=wasm src=main.wasm>
</script>
```
Beautiful, isn't it?
- No more generated JS initialization code
- Direct DOM access and integration
- Better performance on ~all~ most tasks

But then again, HTML is meant to be a "human readable" text format, not a compact binary format, but that's a topic for another day.

## Outro
I hope all of this happens one day. In the meantime, I'm ok with JS runtimes (Node, Deno, Bun, etc...) existing, but eventually more servers should become native executables

See also:
- [The 30M line problem, by "Molly Rocket"](https://youtu.be/kZRE7HIO3vk)