this post was submitted on 11 Sep 2023
32 points (80.8% liked)

Programming

17510 readers
45 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 

On the current typescript / anti-typescript internet drama I saw someone mention javascript without a build step.

Do you think we're already there?

Last time I attempted it:

  • there were too many libraries I couldn't import
  • JSX (using babel) had a warning saying you shouldn't do it in the browser for production
  • there was some advice against not using a bundler, because several requests for different .js files is slower and bigger than a bundled package
you are viewing a single comment's thread
view the rest of the comments
[–] onlinepersona -1 points 1 year ago (3 children)

Does it still make sense to use javascript? I thought WASM would make JS obsolete and introduce web UI frameworks in other languages.

[–] jvisick 3 points 1 year ago (1 children)

WASM’s biggest holdback is that it cannot directly access the DOM. Until then, JS will still have a prominent place in building anything rendered in a browser.

[–] icesentry 1 points 1 year ago (2 children)

That's actually a myth and real world performance isn't affected by this. See this video from leptos creator which is one of the more popular wasm ui framework https://youtu.be/4KtotxNAwME?si=D_vWV1LPQI-C9j8G

The biggest issue is actually the size of the payload since you need to ship the entire app and language runtime.

[–] jvisick 2 points 1 year ago (2 children)

It’s not a question of performance - it’s just the fact that you need to use JS to modify the DOM in WASM. Until there is access to the DOM from WASM, there simply will be a place for JS in nearly every web app and it’s not because it’s fast, it’s because there are still certain things just need to be done using JS.

My point is really nothing to do with performance and I agree with the video you’ve linked: WASM is fast enough today. Whenever you can truly stop using JavaScript, I’ll be the first in line. You can already use WASM and eliminate huge portions of JS - but for anything beyond a very simple UI, you always end up with something that needs to be called in JS.

[–] jeremyparker 1 points 1 year ago (1 children)

but for anything beyond a very simple UI, you always end up with something that needs to be called in JS.

Isn't that why god made HTMX? Jokingly asked, but legitimate question - I don't know much about WASM's reach - and I can't seem to watch that video on the train. Could HTMX (+/- hyperscript) take it from there?

[–] jvisick 2 points 1 year ago (1 children)

You could do HTMX and WASM, but they both have the same problem in that they generally replace elements in the DOM as opposed to interacting with existing elements in the DOM, and most rendering on both HTMX and WASM actually happens through JavaScript calls.

In either case you’re limited to only interact with the DOM at the level of abstraction that the framework provides through “behind the scenes” JavaScript calls which will always be a subset of the DOM manipulation that is possible by directly using JS. At least, until there’s a standard DOM access API for WASM.

[–] jeremyparker 1 points 1 year ago

I keep trying to find a way to play with a web dev stack that doesn't involve JavaScript, but I think that might be a pipe dream...

[–] icesentry 1 points 1 year ago

I mean, I get what you're saying but with rust all that js code is auto generated and you can make a full app without writing a single line of js yourself.

[–] [email protected] 1 points 1 year ago

Here is an alternative Piped link(s):

https://piped.video/4KtotxNAwME?si=D_vWV1LPQI-C9j8G

Piped is a privacy-respecting open-source alternative frontend to YouTube.

I'm open-source, check me out at GitHub.

[–] [email protected] 2 points 1 year ago

A lot of the WASM ecosystem is still pretty rough

[–] [email protected] 1 points 1 year ago

Absolutely. WASM is still not that good or easy.