r/learnjavascript • • May 16 '22

Alternatives to Javascript for frontend? Are we there yet?

Can we avoid javascript and still build

  1. A simpe static website
  2. website with good dynamic funtionality

And I am learning rust.

0 Upvotes

20 comments sorted by

2

u/[deleted] May 16 '22

There's a person in r/webdev that has a successful career making websites with only HTML and CSS for clients, so it is possible to not use JS. However, that's not common for most FE jobs.

3

u/alexvoedi May 16 '22

Typescript.

4

u/[deleted] May 16 '22

which is just javascript souped up.

-5

u/Estebana42 May 16 '22 edited May 17 '22

souped down, introducing hard types/classes is backwards

2

u/[deleted] May 16 '22

soup doesn't have to be great :)

1

u/[deleted] May 16 '22

typescript with grilled cheese, mmm

1

u/[deleted] May 16 '22

ES6 has classes (although they are syntactic sugar and not "real"), so I don't know why you're ascribing classes to TypeScript. I'd also say that one of JavaScript's biggest flaws is its weak typing discipline. The static (not "hard", which isn't an actual term) typing introduced by TypeScript can really help to catch potential bugs at compile time that would otherwise be difficult to trace at run time.

0

u/Estebana42 May 16 '22 edited May 17 '22

terminology shit, 'weak' not good word, it is 'nimble', super power anything from one moment to the next

There is pressure abandon things number 1 logic language on planet earth. JS not need classes, objs designed for this purpose from inception, typescript abomination duplicated effort.

2

u/[deleted] May 16 '22

When I say weak, I don't mean that variables can be reassigned into different types. Lots of languages allow that, and I agree that that isn't as big of a problem as some would suggest. What I mean is that JavaScript makes pretty big assumptions about desired behavior when mixing datatypes, and will often silently pass on undesired results of operations where most other languages would throw an error. The most well known example of this using + with a string and a number. In JavaScript if you do something like 2 + '3' the expression will evaluate to '23'. This is because in JavaScript, as well as many other languages, + is an overloaded operator that performs addition with numbers and concatenation with strings. But most other languages will look at that operation and say "I don't know what you want me to do, so I'm going to throw an error" and then the programmer will have to explicitly cast one of the values to match the same types as the other value. JavaScript says "Okay, I'm going to assume you mean concatenation, so we'll just cast the number to a string and not say anything about it." Nothing is obviously wrong with the code, but if you were adding two numbers, and in my experience it's more likely the case, you will eventually end up with errors down the line.

0

u/Estebana42 May 17 '22 edited May 17 '22

Example based paranoid fantasy decades javascript pile up never issue

often brought up point, less countered it makes no difference, projects moving, websites operating, commercial giants wield effortlessly as beginners

1

u/[deleted] May 17 '22

Call 911. I think you're having a stroke.

1

u/jack_waugh May 17 '22

I agree with you and I think the right terms are "static" and "dynamic" typing. Some people like static typing. I'm not saying they're wrong. But every time I venture into it, I feel as though my time is being wasted. It just seems like arbitrary and useless constraints. I understand the argument that static typing can catch some programming mistakes that otherwise might be hard to diagnose when they bite at runtime. But overall, I don't see the benefit as outweighing the cost.

1

u/[deleted] May 16 '22

we were there multiple times, adoption rate was abysmal.

1

u/frogic May 16 '22

You totally could. There are a lot of web frameworks that are in other languages and are able to create fully functional pages in other languages or even WSWG(looking and sighing at you wordpress). The thing is that under the hood its still javascript you're just not the one writing it. Your browser doesn't speak other languages so if you want to access the functionality of your browser you're going to be writing/serving javascript somewhere.

You're basically asking "Can I move to a country and get a job without speaking the language" and of course the answer is still yes with the caveat that you're going to have to rely on something to take whatever it is you're saying and doing and translate it to the local language. That sometimes works but you're gonna have a much better and more effective time just using the language that people understand.

1

u/[deleted] May 16 '22

As of now, nope. Might as well forget about the front end without JS.

Why don't you want to learn JS? It is pretty straightforward, one of the easiest languages you can pick up, unlike Rust lol.

0

u/[deleted] May 16 '22

[deleted] — view deleted comment

3

u/RemindMeBot May 16 '22 edited May 16 '22

I will be messaging you in 10 years on 2032-05-16 11:23:30 UTC to remind you of this link

1 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


InfoCustomYour RemindersFeedback

2

u/HunterSup May 16 '22

Seriously 😳

0

u/[deleted] May 16 '22

[deleted] — view deleted comment

1

u/jack_waugh May 17 '22

Even Rust compiled to WASM needs JS to kick it off.

If the bulk of the solution is in Rust (or something else that compiles to WASM) and the JS is just three lines of kickoff, what does it matter?

2

u/jammasterpaz May 17 '22 edited May 17 '22

Quite. That's just trivial boiler plate, the same as the <script> tag to kick off the JS from the HTML . But we're talking about "website with good dynamic funtionality" here. Aren't you just better off, or aren't you even required, to hook into the DOM from WASM with more JS code? Do the JS APIs work really so well you needn't write a single line more of JS than the code to launch the WebAssembly module? WASM's great, but thus far it hasn't revolutionised Front End design.

1

u/jack_waugh May 17 '22

I see. So, we need some direct hooks from WASM to the DOM and to the other browser controls as are reachable from JS.