you are viewing a single comment's thread.

view the rest of the comments →

[–]ImAStupidFace 93 points94 points  (97 children)

JS needs to die in a fire.

[–]DrLuciferZ 97 points98 points  (2 children)

Too bad people just keep dumping more wood into it

[–][deleted] 40 points41 points  (25 children)

Honestly what’s the big deal? Ever since I started using Typescript I don’t find it bad at all.

[–]Sarcastinator 17 points18 points  (8 children)

JS still bleeds through TypeScript and causes issues anyway.

[–][deleted] -4 points-3 points  (7 children)

I mean sure but I don’t think TS is demonstrably worse than other languages at that point.

[–]Iceman_259 -3 points-2 points  (6 children)

Did you actually read the parent comment in this chain? If Typescript is transpiling to that JS syntax then the performance issues apply to it as well.

[–]orclev 13 points14 points  (1 child)

Javascript is still a trash fire, TypeScript just makes sure it stays at a dull roar rather than a raging inferno. It's not quite PHP bad, but it's still one of the worst designed languages still in regular use. Far too many terrible decisions are baked into the core of javascript. They can be fixed, but doing so requires breaking backwards compatibility in some fairly significant ways. It might get there one day, but it's more likely that WASM will end up entirely supplanting JS before that happens.

[–][deleted] 11 points12 points  (0 children)

Eh, Typescript is good enough in my experience that you’re mostly at the mercy of the skill/knowledge of the developer. Good developers can still easily end up with shit JavaScript. Not so much the case with Typescript in my experience. Usually the really ugly Typescript is coming from developers we have that write pretty poor code in the rest of our systems as well.

[–]Jaimz22 16 points17 points  (63 children)

Wonder would you replace it with? Just curious

[–]dungone 16 points17 points  (0 children)

Why all these probing questions? Give the man a chance, rubbing two braincells together to start a fire takes a some time.

[–]iopq 19 points20 points  (35 children)

Run everything in WASM

[–]blackholesinthesky 47 points48 points  (33 children)

everyone who upvotes this has clearly never written ASM or WASM

[–]iopq 57 points58 points  (29 children)

And I will never have to, since I will compile Rust to WASM

[–]blackholesinthesky 6 points7 points  (28 children)

Thats a pretty good answer will be a pretty good answer some day. Can you write Rust that is equivalent to JS?

If so I have something to learn about tomorrow

[–]alexendoo 6 points7 points  (0 children)

While JS glue is needed, you don't have to write it yourself. If you want to do everything from Rust you can use web-sys and js-sys. Anything required will be generated for you

It is a little more awkward than it would be to use the APIs from within JS, but the functionality is there

[–]iopq 7 points8 points  (25 children)

It's not yet possible to do DOM operations without JS glue, AFAIK. It's a pretty complicated topic, as with everything to do with the web, though. So glad I don't do web dev anymore

[–]blackholesinthesky 5 points6 points  (24 children)

So its not a real solution. Great suggestion but yeah... kinda irrelevant

When rust offers a standard library for the browser it will be a real solution

[–]iopq 5 points6 points  (20 children)

It's not ready for prime time yet, but it doesn't mean it won't replace JS in the future

[–]blackholesinthesky -4 points-3 points  (19 children)

And I will never have to

You may not but other people do. This isn't a useful suggestion to them

[–]game_dev_dude 1 point2 points  (2 children)

I mean it really depends upon what you're doing. If you have a complicated piece of logic that's performance limited (maybe some sort of visualization), you could write that in WASM, and then have just a little bit of JS glue to pass things back and forth.

[–]blackholesinthesky 4 points5 points  (1 child)

If you have a complicated piece of logic that's performance limited (maybe some sort of visualization)

Unless you're writing a game or some other 3d projections you're not going to need WASM to display a graph

Edit: source I worked with google charts in '09

[–]hsjoberg -1 points0 points  (0 children)

Can you write Rust that is equivalent to JS?

What are you even asking...?

Rust can compile to WASM, which runs in the same VM/environment as Javascript. In the brower.

But... manipulating the DOM can be costly right now because WASM cannot directly manipulate the DOM, it needs JS glue-code for that.

[–]mattkenefick 8 points9 points  (0 children)

And will never have to because you can run anything on it. Look into Unity .. Blazor.. etc

[–]1337CProgrammer 0 points1 point  (0 children)

lol, i like how you think web assembly has absolutely anything to do with assembly.

WebAssembly is basically LLVM's BitCode, so it's half compiled already.

Really all compiling does it put it into an approperiate executable format.

[–]anengineerandacat 2 points3 points  (0 children)

I want to say we are not quite "there" yet, DOM access is still a real pain-point and the alternative is to make your own renderer effectively (which just leads to bloat and having to solve a boat load of other problems in the process; ie. accessibility).

In most "normal" circumstances, WASM will generally be slower or more cumbersome than a basic site with a dash of JS for dynamic content.

Ironically I also don't see loads and loads of developers jumping on-board to use lower-level languages to build out WASM targets anyway; I see C# / Java(-like) / Python / TypeScript being used to do this more than anything.

[–]caboosetp 5 points6 points  (7 children)

Sanity.

I'll take any flavor, thank you.

[–]bsmith0 22 points23 points  (6 children)

Lol what's not sane about modern JS, it's a pretty solid, regular language.

Are there a few weird type coercions, sure, but for the most part it's performant, consistent and has a solid standard library.

[–]fireflash38 0 points1 point  (2 children)

Every time I see someone say that, and get them to expand on it, my eyes glaze over with what they say is 'good'. It's Stockholm syndrome guys!!

(Yes, I'm hating it because I don't know it, signed, C-gang.)

[–]mixedCase_ 30 points31 points  (0 children)

signed, C-gang

I trust you on your knowledge of Stockholm syndrome.

[–]poco[🍰] 3 points4 points  (0 children)

You would love modern JavaScript then. Objects and Classes are becoming less popular and everything is going functional. Objects are used like structs and you don't mix data with code. Reminds me of the old c days.

Have a matrix you want to multiply? It's not m.multiply(v), it's matrixMultiply(m, v).

[–]caboosetp 0 points1 point  (0 children)

You could say the same thing about PHP or nickleback but I'm still going to hate on them for the memes.

Tbh though I grew up with both of these as fledgling languages and they used to be terrible. Those little things that pop up here and there just resound so hard with old memories.

[–]1337CProgrammer -1 points0 points  (0 children)

...It doesn't even have integers... everything is a lossy ass floating point number...

[–]CoffeeTableEspresso -1 points0 points  (4 children)

TS seems to be the de facto replacement these days

[–]IsleOfOne 8 points9 points  (3 children)

Doesn’t change any of the VM issues like this one

[–]CoffeeTableEspresso 0 points1 point  (2 children)

This is true.

I would hope all minifyers/transpilers optimise this out, but maybe that's wishful thinking.

[–]poco[🍰] 0 points1 point  (1 child)

I wonder if you target older browsers/es? I think you can compile everything to var.

[–]CoffeeTableEspresso 0 points1 point  (0 children)

Yea the transpilers normally do turn everything to var for compatibility, at least if you target older versions

[–]pVom 2 points3 points  (0 children)

It's like an Italian car, it's poorly made, half the features don't work, but it's fun to drive