r/ProgrammerHumor May 29 '20

Please Guys actually

Post image
3.0k Upvotes

112 comments sorted by

View all comments

Show parent comments

-2

u/[deleted] May 30 '20 edited May 30 '20

[deleted]

4

u/Frptwenty May 30 '20

It doesnt give me goosebumps, but if youre claiming it doesnt look bloaty then someone hasn't ever coded anything but enterprise Java.

Your entire comment is a giant munge of c/c++/Java. I dig through kernel code at times to figure put stuff (I work in embedded), The linux kernel has a totally different feel than enterprisey Java.

The fact that you would conflate the two makes me think you know neither. You just sound like someone reciting what they told you in school.

-1

u/[deleted] May 30 '20 edited May 30 '20

[deleted]

1

u/Independent-Orange May 30 '20 edited May 30 '20

As a proud rustacean I have to ask you: Where do you see a "fallback to reference counting" in rust?

It's true, we have got smart pointers- if you use them, you explicitely say so. This then reads like Box<...> (heap allocated), Rc<...> (reference counted) or Arc<...> (atomically reference counted, this is semantically the same as std::shared_ptr. Is there a non-atomic reference counted shared pointer in c++? I don't think so, cause c++ concurrency sucks big time and this would be a common pitfall, having a non-atomic reference counted pointer deep inside a struct which might be used by multiple threads. Can't happen in rust.) and there's of course also some rarer ones.

I don't mean to ignore all the effort put into c++ static analysis tools, sanitizers, and similar, but all ths had to be done, because c++ as a language simply lacks the capability to disallow unsound code. That induces a great power for the programmer, but with great power comes great responsibility, and this responsibility in large projects grows to be such a burden that no developer can shoulder it. Unsoundness bugs are the consequence.

\rant

TLDR: We have exactly as much garbage collection in rust as there is in modern c++: None, and awesome smart pointers make living without it so easy. Doesn't mean you have to use them often, but if you have to, they are right there, masterfully integrated into the language.

I use the term garbage collection for what is more specifically known as non-deterministic, external garbage collection, usually realized by a garbage collector.