←back to thread

177 points signa11 | 6 comments | | HN request time: 0.729s | source | bottom
Show context
kstrauser ◴[] No.42160831[source]
Rust was a pain in the ass until I stopped trying to write C code in it and started writing idiomatic Rust. I don’t know the author of this blog, but he mentions extensive C++ experience which makes me wonder if he’s trying to write C++ in Rust.

Maybe not! Maybe it’s truly just Rust being stubborn and difficult. However, it’s such an easy trap to fall into that I’ve gotta think it’s at least possible.

replies(3): >>42160844 #>>42161027 #>>42161181 #
1. Aurornis ◴[] No.42161181[source]
> Rust was a pain in the ass until I stopped trying to write C code in it and started writing idiomatic Rust.

This is the #1 problem I see with people trying to learn a new language (not just Rust).

I’ve watched enough people try to adopt different languages at companies over the years that I now lean pessimistic by default about people adopting new languages. Many times it’s not that they can’t learn the new language, it’s that they really like doing things the way they learned in another language and they don’t want to give up those patterns.

Some people like working in a certain language and there’s nothing wrong with that. The problems come when they try to learn a new language without giving up the old ways.

Like you, I’m getting similar vibes from the article. The author wants to write Rust, but the entire premise of the article is about not wanting to learn the rules of Rust.

replies(5): >>42161933 #>>42162613 #>>42163170 #>>42167602 #>>42170866 #
2. zanderwohl ◴[] No.42161933[source]
> This is the #1 problem I see with people trying to learn a new language (not just Rust).

Definitely! I've also noticed people will learn a group of similar languages, like Java, C#/.Net, then Kotlin as the most distant relation. Now, they think they know many languages, but they mainly have the same core idea. So when they try something new like Haskell or Swift or Rust, they think it's doing something different from the "norm" in a really irritating way.

3. donatj ◴[] No.42162613[source]
Trying to convince developers from "classical" OO that not everything needs to be a class in JavaScript has been a major thorn in my side for years. Your little procedure with no state? That can just be an exported function.
4. pansa2 ◴[] No.42163170[source]
> The problems come when they try to learn a new language without giving up the old ways

In Python, I frequently see the same problem from the other side. Instead of C/C++ programmers learning Rust and "not wanting to learn the rules of Rust", it's Java/C# programmers learning Python and not wanting to unlearn the rules of Java/C#. They write three times as much code as they need to - introducing full class hierarchies where a few duck-typed functions would do.

5. dijksterhuis ◴[] No.42167602[source]
it’s not just languages.

i had similar problem with tensorflow for like a year or so until it “clicked” i was trying to make the framework do thing the way i wanted, instead of doing things the way the framework wanted.

seeing that in myself was a real eye opener.

now i see it in others too and it’s frustrating because, ultimately, no-one can tell them they’re doing it. they have to find out for themselves for it to make a difference for how they act.

6. munksbeer ◴[] No.42170866[source]
Would you be able to give an example of what you mean? What it would look like trying to write C code in Rust and then the idiomatic Rust way?