News for hackers. Stuff that matters.
Re:Death to C by Animats on Saturday May 02, 2015 @02:45PM (#9478072)
Rust people, please don't screw up. We desperately need a replacement for C. Rust could be it. But it's not too late for the Rust crowd to blow it. Rust may have too much cruft at version 1.0 for C programmers.

Things that worry me about Rust:

* Too much mandatory metaprogramming. Basic things such as I/O require generics, and even lambdas. Rust's cruft level in this area picks up where C++ with Boost left off.

* Error handling is too verbose. Wrapping things in "Result<>" and "Some<>", then unwrapping them with "match" is wordy. Wrapping that in generics makes it shorter but hides what's happening.

* The type system and type inference are very complex, and type errors induced from another module can be hard to diagnose.

* Too much language churn. Supposedly "stable" modules still keep changing. I'm surprised when I recompile a program after a few weeks and it still works. This needs to settle down very soon.

* Resource Allocation is Initialization. Initialization isn't that bad, but what do you do about an error discovered in a destructor? Destructors are always troublesome, and Rust doesn't seem to have that area under control. A "with" clause approach would have been cleaner. The recent discovery of a soundness problem in Rust destructors is being handled in a way that bears watching. First, the actual issue reporting the problem was closed without a fix.[1] The discussion was "moved to an RFC" so as not to block the release of Rust 1.0.[2] Related issues are now being discussed to death. A good discussion of the issue is at [3].

While Rust avoids complex run-time abstractions, it has very complex compile-time abstractions. Rust has all the cool abstraction ideas - closures, generics, templates, type inference, RAII, functional programming, etc. This may be too much for the C crowd. The basic libraries use all these features, so you can't restrict their use on a project.

[1] https://github.com/rust-lang/rust/issues/24456 [2] https://github.com/rust-lang/rfcs/pull/1066 [3] http://smallcultfollowing.com/babysteps/blog/2015/04/29/on-r...

Re:Death to C by barosl on Saturday May 02, 2015 @11:12PM (#9479655)
I understand your anxiety on the complexity of Rust. I wonder if there were a language that fixes exactly the pitfalls of C (e.g. sane string manipulation), without adding any high level concepts, but with memory safety.

However, at the same time I think the language researchers cannot help but add abstractions on today's languages. The unusual exception was Go, but it failed to target the same niche as C/C++ at the end. Actually I think there are more people who like abstractions than those who like the extreme simplicity of C. So unfortunately, a "direct" replacement of C will not happen in the foreseeable future, I think.

Re:Death to C by Animats on Sunday May 03, 2015 @01:00AM (#9480016)
It's not bad that the language has those features. It's that their use is so deeply embedded in the libraries that all Rust users must understand them to do anything. It's a big jump in abstraction for C programmers.
Re:Death to C by barosl on Sunday May 03, 2015 @03:17AM (#9480355)
Indeed! That's why I'm still not used to Haskell. While I can do simple things with the language, the abstractions made by the popular libraries written in Haskell require me to understand a certain concept to use them properly.

However, while the feature complexity can be avoided at least in the standard libraries, I think that's a more general (possibly cultural) problem, considering a Rust developer will have to use any libraries other than the standard libraries at the end.

I believe that's why the Go designers are so wary of adding new features to the language. If there's a feature, library writers will use that feature. Nothing can prevent this.

Re:Death to C by mastax on Sunday May 03, 2015 @12:20PM (#9481887)
You make good points. I have some things to add: * Error handling can be made less verbose using the try!{} macro. * The Rc issue was moved to RFC because any such change would require one per the guidelines at [1]

[1] https://github.com/rust-lang/rfcs