Hacker News new | ask | show | jobs
by sedeki 1302 days ago
I have worked as a C++ dev, but am definitely not a C++ expert by any means.

My take however is that C++ is inherently a complex language due to deliberately not sacrificing backwards-compatability of the syntax and semantics, which has been creating a mess as the language has evolved: there are many, many things to define semantically in order to "fit" a new piece in this old already-elaborate puzzle that is the C++ standard.

You cannot say the same thing about Rust.

Please correct me if you see things differently.

2 comments

> You cannot say the same thing about Rust.

At least not yet. My fear is it's _very_ easy to fall in to the same trap as C++ has, and become a big mess. Scott Meyers have a very nice talk here: https://www.youtube.com/watch?v=KAWA1DuvCnQ about all these traps and pifalls that we have to deal with in C++.

That said, I'm starting a bit with rust and enjoy it so a lot, especially the tooling alone is worth it - and if I never have to write another line of C++, I would be very happy (ofc the real world argues I have a lot of C++ code that will need maintenance).

When I tried Rust I came from Python and it was clearly too much for me to comprehend but after 2 years of C programming and 1 year of C++ programming, the problem Rust tries to solve make a lot more sense and I know understand the problem it's trying to solve. I am trying to use it again things like the borrow checker and Traits now make a lot of sense to me. I am also looking forward at not having to write C++ again. I haven't looked into C++17 and beyond though I must admit.
If you stick to a subset of C++ it's not so ugly since that's before all the new stuff got bolted on. Rust might undergo similar uglification, but the clean subset should still be there and is better than any clean subset of C++. I still hope that doesn't happen though.
Give it 10 years and people will feel similarly about Rust. They’re both just super-complicated languages.

Some devs thrive on that, but most people can’t and shouldn’t have to. And you can see that contrary to what some in the Rust community are saying, there’s a push to use Rust for web. Bonkers.

I find most languages are fairly simple. The std lib that goes along with them on the other hand... Those are the monsters in the room. Take java for example. Do you think java is verbose because it is java? Or is it because of the libraries you use?

When you boil code down to its bare essentials it is moving stuff from one part of memory with a possible transform to another. C does that exceedingly well and gets out of the way. However, the heavy price we pay for that is low type/bounds checking. Pretty much all other languages have tried to get the 'get out the way of part' but with type checking. Rust has taken the approach of you ask for memory and it is tracked at compile time. Not a bad idea. But it seems to trip some people up. Especially if you do not 'get' the idea of object/memory ownership. Which is something you have to do manually in C/C++. C++ has started to put wrappers around all this junk which helps.

Do you write in Rust much, or do you have your own blub language?
Not much, have enough on my plate with C++.
If you get the chance, do take a serious look at Rust (as in, write something significant in it). You might be surprised at just how suitable it is for high level stuff.
I (re)wrote a < 1kloc program in it from C++ and I found that it had its good and bad parts, like everything.

But there’s too much overlap with C++ and not enough projects. IMO Rust has proven that it can survive, but by far hasn’t reached enough popularity to justify a switch and keeping two complex yet similar languages in ones head is unwise. So I’d rather focus on Go and Python which actually bring something complementary to the table.

I guess I had the benefit of not having the C++ experience baggage (mostly C and Python) ;)
Honestly the rust web frameworks are quite good. I don't find them any more verbose than say typescript or golang because enough higher level types exist to abstract away complexity. Majority of api code is just crud and business logic so it makes any difference in which language it's written in terms of complexity.

And the rust ORM libraries are catching up with other languages so there is no additional advantage from picking a gc collected language.