Re:Cross-platform Rust rewrite of the GNU coreutils
by quotemstr on Tuesday March 22, 2016 @11:35PM
(#11341969)
Every function in the C++ standard library reliably communicates allocation failure to the application without relying on aborting the whole program. If Rust can do it, C++ can do it too. Rust got itself into this trap by eschewing exceptions.
Re:Cross-platform Rust rewrite of the GNU coreutils
by tatterdemalion on Wednesday March 23, 2016 @12:06AM
(#11342091)
Maybe avoid using judgmental language like calling a standard allocator that aborts on oom a "trap." The Rust team made conscious design choices in full awareness of the trade-offs. Moreover, Rust actually does have thread unwinding, and even the ability to catch an unwinding thread, so it is not true that the Rust standard library could not have unwound on oom.
Rust's standard library just isn't designed for writing applications that need to survive oom errors. That's fine, its not designed for a number of other applications which Rust the language is well-suited for either (operating systems, for example). Its designed for the majority use case, because life is full of trade offs.
Re:Cross-platform Rust rewrite of the GNU coreutils
by quotemstr on Wednesday March 23, 2016 @04:55AM
(#11342953)
If Rust isn't suitable for C's niche, Rust's proponents should stop pitching Rust as a replacement for C.
> The Rust team made conscious design choices in full awareness of the trade-offs
I don't think that anyone who isn't already predisposed to avoid exceptions would consider the tradeoff the Rust people made to be the correct one.
Re:Cross-platform Rust rewrite of the GNU coreutils
by tatterdemalion on Wednesday March 23, 2016 @01:15PM
(#11346368)
This is absurd. Most C applications do not need to persist through OOM errors, and has people have repeatedly reiterated, it is totally possible to write a Rust program that persists through OOM errors.
Most programs can't tolerate oom errors, though, and it would be absolutely unreasonable for every function in the standard library that might perform an allocation to return an error that has to be handled by every programmer all the time.
EDIT: C's solution is to make it very easy to ignore oom errors, so most programmers just don't handle oom errors. Rust's solution is much better.