Why Mozilla made Rust-Lang hard?

Hello,
Why Rust-Lang syntax is odd and hard to learn?
A beginner can't learn it.

Cheers.

1 Like

"Odd" and/or "Hard" compared to what?

It's certainly harder that BASIC. But then it needs to be to get done what it is designed to do.

It's likely easier than C++. I don't believe any single human understands all of C++ and an how all it's parts interact.

Rust might be odd if you are familiar with Haskell or COBOL. But then they are odd to those looking at them from the Ada, Pascal, C world.

Do you have experience of some other programming language? Perhaps people can tailor any advice to that background.

I feel your pain. Being a beginner and getting familiar with almost anything so complex as a programming language is hard.

2 Likes

Maybe it's because Rust has features that look very abstract, and are hard to understand without knowing how the compiler works : lifetimes, traits, generics...

The question is also: is it possible to make an easier language with the same other characteristics?

Most, if not all, features have been weighed for how easy they are to get vs. how useful they are. For instance, on a surface syntax level, there were large pushes to make generics use [] notation, but the prevailing argument for <> instead was that it reduced the "weirdness factor" when coming from languages like Java and C++.

If you're interested in the history, there are a lot of discussions about pretty much every language decision available at the RFCs repository. Specifically, the RFCs here: https://github.com/rust-lang/rfcs/tree/master/text are listed in historical creation order. Each RFC documents what change was made, and why it was made. They also each link to a "RFC PR", which contains the discussion the community had when first looking at the change, and the various pros/cons that were weighed in the decision.

I've found the nearly 6 years of language decisions + arguments invaluable for understanding why Rust is the way it is. And part of that is why it chose to be so complicated, as opposed to being a simple language.

3 Likes

Rust is focused on safety, correctness and performance. These are hard problems.

Some languages are easier to learn, because they don't insist as much on safety and correctness. They don't complain when programmers write code that is imprecise, doesn't handle all errors, or is not thread-safe. Writing correct programs requires thinking about a lot of details, and this is hard.

Some languages are easier to learn, but the ease comes at cost of slower runtime performance or higher memory usage. Writing fast and efficient programs is difficult.

This is not saying that Rust is better or worse than other languages. If you need to have code that is safe and fast, then this is a difficult task, and it may actually be less difficult if you use Rust.

If you don't need to maximize performance, and/or you think you can ensure safety and correctness of your programs without language's help, then other languages may be better for you, and easier to learn.

2 Likes

What a beginner can or cannot learn will depend largely on the beginner, on the guidance she gets etc. If you pointed out which aspects of hardness are in question, people here could probably explain each of these, but a forum is not a good place to address all of them.

But in essence I think you are right. Rust is certainly no mainstream contender for "best first language". Now, there is no lack of good first language candidates: Python comes to mind, JavaScript, Racket, maybe Go? Each tool to it's application and I have not seen Rust being advocated for first-time-programmers.

2 Likes

This question has pretty much been answered. Locking up.