This hybrid approach that requires JS both at bootstrap and browser-API-interaction time significantly undercuts the benefits of WASM as a javascript replacement for several reasons. Some of those reasons are: this likely means JS will remain supported/enabled/required-for-many-sites in browsers, warts and all, in perpetuity; the advantages of WASM's sandboxability will be mitigated by the presence of a much more permissive runtime that must be present in order to load and run WASM artifacts; more performant/parallel access to browser APIs will remain difficult or impossible; multi-language/multi-build system competence will be needed due to large parts of the ecosystem remaining in browser JS.
So even if you get other languages working alright on browsers, they are always going to be second-class citizens IMO, because they are going to be interfacing with JS APIs.
I can't think of a way to avoid this TBH, other than designing a different API for the new language, at which point i think we'd be no longer talking about the web as we know it.
For example, an API like `Element.prototype.addEventListener(string, callback)` wouldn't make much sense in Rust, IDK about Go. Sure, you can make it work, but you'll always be rubbing against an API that was not designed for that language. Hell, addEventListener isn't even on the Element prototype, but on the EventTarget prototype, which Element.prototype inherits from. And that's something else that wouldn't make sense at all in Rust: prototypical inheritance. But it's part of the DOM API. It's part of the web. So we'd have to deal with it too, even if we switch to a new language.
Does this make some sense? I feel like i'm repeating what's been said before in this comment chain, so maybe i'm missing something about what you're not understanding (:
https://github.com/andrewarrow/homeducky/blob/main/browser/r...
https://github.com/andrewarrow/homeducky/blob/main/browser/t...
https://www.youtube.com/watch?v=dxO94MvfRCg
here's example coding frontend in go. I think I've achieved with vote.go and register.go and timer.go above a nice way in Go to do Javascript things. I don't feel limited.
<script>document.addEventListener("DOMContentLoaded", function() {
const go = new Go();
WebAssembly.instantiateStreaming(fetch("/assets/other/json.wasm.gz"), go.importObject).then((result) => {
go.run(result.instance);
WasmReady('welcome.html');
});
});</script>and <script src="/assets/javascript/wasm_exec.js" class="">
and that's it! Then from go there's nothing I can't do in the DOM.
tldr: no, you can't possibly be doing that. Because an api for it literally, objectively does not exist.