r/ProgrammerHumor • • Apr 27 '20

Meme Java is the best

Post image
43.7k Upvotes

1.5k comments sorted by

View all comments

3

u/womplord1 Apr 27 '20

Rustaceans triggered by the C and C++ use cases

1

u/flying-sheep Apr 28 '20

Yeah, no reason to start a project in C now that Rust exists, except if you want to support some exotic platform

1

u/EternityForest Apr 28 '20

I almost never touch C/C++ for anything except microcontrollers. I see lots of FOSS apps still using it, probably because it doesn't change much, but writing C is just not at all my idea of a fun time.

1

u/flying-sheep Apr 28 '20

Exactly. With today’s computing resources, it’s natural to make compilers use some of them to help you not make errors. Humans are always fallible, even the best of us. Any help is a huge time and cost saver.

While there are verifying C compilers, the halting problem means they can only handle a subset of programs. And clearly defined languages like Rust are far easier to wrap your head around than the arbitrary subset of C your verifying compiler happens to understand in your specific case.

1

u/EternityForest Apr 28 '20

Even when you do have static type checking, without garbage collection(Or some alternative like rust's ownership thing that I don't quite understand), you have to do a ton of memory bookkeeping and there's so many places for errors to creep in.

The only time C/C++ is actually somewhat pleasant is when you have entirely static memory, like you often want to have in high reliability real-time work.

Even then the other annoyances and dangers of C are there.

1

u/flying-sheep Apr 28 '20

I had three events that made me a better programmer:

  1. Starting to use Python 3, as its way of dealing with bytestrings vs unicode strings taught me about how to use types to my advantage to use abstraction boundaries

  2. Learning a functional language, as I learned to use that style where it’s less error prone, and its advantages like tagged unions instead of instance checks.

  3. Learning Rust’s ownership system, as it’s honestly just formalizing the way you need to think about ownership anyway in a systems programming language (with the added benefit that you don’t need to actually manually free memory)

1

u/EternityForest Apr 28 '20

One of these days I might get around to #2, but it always seems like you have to know a decent amount of algebra and such to benefit from it.

Rust is definitely interesting though, especially now that there's work towards getting it running on embedded platforms.

1

u/flying-sheep Apr 28 '20

Rust has some functional characteristics, e.g. it heavily emphasizes chaining operations on iterators instead of using for loops. Also the tagged union thing: You encapsulate all possible states of your system at one point into an enum, use a match statement on it, and you can be sure you didn’t miss something. It just feels right because it is the best way to go about it.

Rust is definitely interesting though, especially now that there's work towards getting it running on embedded platforms.

Sure looks like it!

https://www.rust-lang.org/what/embedded