Hacker News new | past | comments | ask | show | jobs | submit login

I feel like Rust makes you pay a big cost upfront, and the benefits are often not worth that cost.

It's easier to program if I don't have to worry about ownership/lifetimes. -- Garbage Collection allows not needing to worry about lifetimes; and preventing the same value from being mutated from multiple places in the code generally isn't such a significant problem.

With high level programming (in JavaScript), you don't have to pay those costs.

I like to believe that Rust's strict discipline about ownership/lifetimes encourages code that's fast/lightweight, though.




Absolutely. Most programs should be written in a safe language, but that doesn’t mean Rust. Most programs should be written in a garbage–collected language like Javascript or Python or Lisp precisely because those languages make developers faster and more efficient.

Rust is only appropriate for programs that are too expensive to run when they are written in a garbage–collected language. That means operating systems, because small inefficiencies there will add costs for billions of people. It means big server–side services, where small inefficiencies cost you millions in compute time or ram usage or whatever.

Even if you think you’re going to hit that scale one day, writing your prototype in a garbage–collected language can net you a huge advantage in time saved. You can rewrite it in Rust later, after you know exactly what features will be needed and exactly what they cost to run, and exactly how much you’ll save by rewriting it in Rust.


If programmers will learn Rust as first language, it will be natural to them. I use Rust since version 1.0, and I like that borrow checker helps me to find bugs at design state, where they are least expensive to fix.


> If programmers will learn Rust as first language

Imagine a person who just started learning about programming. A person who may still be tripped up by the fact that `=` and `==` are completely different things here.

Imagine that person.

And now imagine explaining to that person a language, that even many experienced and skilled software developers say is significantly harder to learn than the average programming language.

Sorry, but when I think about a good teaching language, Rust isn't the first thing that comes to my mind.


And neither is C/C++, in which you have to follow all the borrowing rules except the compiler maybe sometimes warns you about something instead of always erroring out.

Python, go or (a bit less so) typescript are nice beginner languages.


C++ isn't, but C was my first programming language, and I am thankful for this to this day.

Because C in and of itself, is an incredibly simple language. It is made complex in libs, usually by abusing macros, or by trying to shoehorn it into OOP, FP, or whatever other paradigm is currently being idolized.

> Python, go

Go yes, Python no, and I am saying that as someone who does alot of work in Python and loves both languages.

Because Python isn't simple. It looks simple in trivial code, but hides an enormeous amount of complexity and magic not-so-far beneath the surface. In addition, it completely fails at teaching core concepts of memory, and dances around the topic of types.


But C is anything but simple! It's small but it's so full of undefined behaviors it requires considerable knowledge and experience to stay within the bounds of 'predictable'. It's better nowadays if you are taught to enable all possible warnings and even then you'd better use a static analyzer and valgrind for anything more than hello world.

Python's hiding of memory is a feature when teaching beginners programming IMHO unless you want to start teaching close to the metal. I prefer to start from the algorithmic CS-y side.


> it requires considerable knowledge and experience to stay within the bounds of 'predictable'

No it really doesn't. Initialize all variables, always check boundaries and free memory when you're done with it. That about covers 90% of it.

Yes, this becomes more difficult the less trivial the codebase becomes. But beginners don't have non-trivial codebases, and teaching these concepts isn't hard.

> Python's hiding of memory is a feature when teaching beginners programming IMHO unless you want to start teaching close to the metal. I prefer to start from the algorithmic CS-y side.

And I prefer to start from the systems-programming, practical side. And in the practical world, memory isn't some abstract thing that may or may not exist, function calls cause overhead, strict typing is a friend, and networks fail.

So yes, teaching a bit closer to the metal has its advantages.


Pascal, C, Java are used as first languages successfully. Why Rust cannot? It's even easier to use than C and Pascal.

Rust is hard for older programmers because it's hard to FORGET old habits from other languages, which allowed too much.


> It's even easier to use than C

No, it isn't, by any metric. I personally know people who learned C in a week. I learned all basics of the language in 2 weeks as a teenager, with nothing but K&R as learning materials.

If you disagree, point out by which metrics you consider Rust to be easier to learn than C, and we can have a discussion.

> Rust is hard for older programmers because it's hard to FORGET old habits from other languages, which allowed too much.

No it isn't. First, both newcomers and experienced programmers consider Rust a more complicated language than most of its contemporaries, and if anything a solif experience in multiple programming languages makes it easier to learn the advanced concepts Rust relies on.


Rust can be used as C, because it has pointers, like C. However, Rust has better syntax, more syntax sugar, automatic memory management, automatic memory manager and borrow checker. So, Rust is simpler than C to learn.


> However, Rust has better syntax

Better by what metric?

> more syntax sugar

More features and syntactic concepts don't make a language easier to learn.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: