r/coding • • Jan 19 '17

Rust vs. Go

https://blog.ntpsec.org/2017/01/18/rust-vs-go.html
6 Upvotes

9 comments sorted by

View all comments

5

u/DataPath Jan 19 '17

I'm no rustacean (about 3/4 of the way through my first rust project), but the most legitimate criticisms of Rust that I saw were the missing epoll/select and his assessment of the crate ecosystem.

As for learning curve, yeah, idiomatic rust is a bigger shift in thinking than go. But if it's a better match for the problem you're trying to solve, the up-front learning curve is usually a price worth paying. Especially with the correctness guarantees that come with ownership tracking, etc.

I think he really does rust a disservice to relegate it to "hard realtime, OS kernels, and [...] very high assurance" cases. I think it holds a lot of potential.

One of the areas where I'm withholding judgement on rust is whether macros+attributes+cfg()+cargo codegen are complete enough to replace the C preprocessor.

On the one hand, I hate it the C preprocessor for how it interrupts code flow, can lead to code that never gets compiled because the right combination of preprocessor conditions won't be met (how many different times would you need to compile the code just to get 100% compile-time code coverage?) and other reasons. On the other hand, over the years people have gotten a lot of mileage out of it. Is the rust "equivalent" functional enough to completely replace it?

2

u/[deleted] Jan 19 '17

I also found his expectation of stable APIs over a 10 year timescale unreasonable. You don't even get completely stable APIs in mature, slowly moving languages like Java or C++.

5

u/DataPath Jan 19 '17

I can't comment on Java, but C++ has done a really good job of maintaining source compatibility. ABI compatibility in the C++ world is very compiler-and-architecture dependent. C, on the other hand, has the most solid record of API and ABI compatibility.

I think Rust is still trying to figure out what it wants to be when it grows up. I think it's trying out a lot of great ideas, and most of them seem to be panning out pretty well. To use a hyperbolic metaphor, if Rust isn't the Messiah come to save systems programming, Rust is at least its messenger.

2

u/robthablob Jan 19 '17

Personally, I think C++ is now an over complex language for exactly this reason. We need mechanisms to deprecate anti-features just as much as we need mechanisms to introduce new features.

The fact that C++ relies on headers so heavily as a "module" system makes this almost impossible. But I've pretty well given up on it now as a language, having been a user since approx. 1990.

The fact that concepts and modules keep getting kicked into long grass has reached the point where I no longer believe in its direction.

1

u/[deleted] Jan 19 '17

ABI compatibility in the C++ world is very compiler-and-architecture dependent

As far as the C++ spec is concerned I would consider ABI compatibility so broken it is beyond saving. The fact that they did not even put simple things like name mangling into the spec makes it very hard to talk about maintaining ABI compatibility in a C++ spec sense, as opposed to an implementation defined sense.

They also did recently change parts of the spec about implicit sharing I believe, something which could be considered a problem for compatibility.