Old Programmer that's New to Rust

Rust seems overkill for a basic web application.

What do you mean by "overkill?" I do not understand that logic at all.

1 Like

Not saying this is you, but a lot of people, myself included, used it for many years without actually learning it. When I did sit down and learn it (ES6, functional programming, promises, async etc), it changed my understanding of it. The tooling too changed dramatically over time. I would go as far as to say that before npm, it was almost a whole different language.

You are planning too far ahead. Javascript/Typescript will remain the dominant languages in browsers for at least a decade. WASM may be the future, but that is not yet set in stone. There is significant danger living on bleeding edge software. Rust changes rapidly (I use code that will only compile in certain versions of nightly). It is a great language, but it is designed for specific use cases, and general browser UI is NOT a good use case. Not even close. Rust does not have a garbage collector. Garbage collectors are fantastic when you can afford the memory overhead and less than perfect deterministic timing and don't need the absolute best possible speeds. To give up on the garbage collector you need a really good reason. I am sure there are other great languages with garbage collection much better suited to UI design. TypeScript has the advantage of not even needing WASM. Rust does have its place. But that place is where garbage collection is not desired. As stated before, choosing rust for UI would dramatically increase your development costs and future support costs with no real gains. On the back end actix-web is certainly fast, and reliable in my experience but keep in mind that finding good documentation/help for anything in rust can be a lot harder than for Javascript simply because the community is currently so much smaller. Most Rust projects have documentation for the project, but the moment you want to do something not in the project docs, it can be a struggle to figure out.

No, that is not me. I've used it heavily over the last two decades, and each and every line of it I write makes me hate it more. I've also used C# over almost all of that same time which points out the flaws in JavaScript as a language constantly. Everything about JavaScript that has improved over time is due to Microsoft pushing it kicking and screaming through ECMA and using TypeScript to make it suck less. But at the end of the day, it's still a highly abstracted VM with crap memory management, no real threading hosted in a sandbox built by Google to let Google's ad sales do what it wants to do while constantly changing the rules on third parties that were critical in it becoming the dominant sandbox. There is nothing sane or logical about the language, its syntax, it's de-facto runtime and the process that specifies it.

1 Like

On the other hand...

Brendan Eich tells how in the early days when Netscape was getting JS standardised there were things he wanted to fix before it was standardised. However Microsoft muscled into the standards body and demanded the "bugs" remain and get written into the standard. It took many years to address those MS induced problems.

The VMs and memory management are great now a days. I have pitted Javascript vs Go for streaming data on servers. The JS suffered far less jitters and stalls due to garbage collection than Go. As a result we adopted node.js back when it was new on the block.

Those Google sandboxes and browser API's etc, are nothing to do with the Javascript language per se. I will grant you that a lot of that web technology is awful and seems to have been designed for maximal insecurity.

As for threading, well that is the whole point, part of the magic of Javascript. It is designed not to use threads. Instead it has an asynchronous/event driven programming model which allows one to all the things one might other wise use threads for but far more efficiently and, importantly, far simpler for the programmer.

Notice how other languages, Java, C#, Rust, Python, C++ have only recently added asynchronous programming to their arsenal. JS was way ahead.

I have two favourite languages just now, Rust and Javascript. They are polar opposites in pretty much all ways but they stand out from the pack for their ingenuity.

[Folks, please don't start or continue debates about JavaScript here.]