News for hackers. Stuff that matters.
Re:Rust and Nix = easier Unix systems programming by laughinghan on Thursday April 14, 2016 @01:35PM (#11498767)
I don't think this is unfair. In order to fail as badly as the sloppy C program, the Rust developer would have to explicitly pass in -1 as the default_value, like fork().unwrap_or(-1), right? The developer might do that anyway, but that's certainly an improvement over -1 happening implicitly; they'd have to think about it, and alarm bells would go off as soon as they re-read the kill() manpage, rather than only upon re-reading both the kill() and fork() manpages.

Similarly, neither of your "if let Some() = fork()" examples would fail as badly as the sloppy C program, right?

All the examples you could come up with of sloppy Rust code fail less poorly or make it harder to fail as poorly as the sloppy C code, and you were deliberately trying make your Rust code sloppy, whereas the sloppy C code was based on examples from the wild: http://rachelbythebay.com/w/2014/08/19/fork/

Still seems like a good argument that Rust's design is an improvement.

There are no comments on this comment yet.