Re:Why I'm Choosing C++
by pcwalton on Monday February 01, 2016 @12:57PM
(#11013625)
> However, fixing some of those will break backward compatibility one way or other and require effort that would be unnecessary otherwise.
We aren't changing anything you're talking about, except for bugs.
> In what order are subexpression evaluated in Rust? Unspecified yet, in fact it is even worse than that, it differs between borrow checkers (which I think uses the most useful one given Rust syntax: right to left behaviour), while code generation assumes left to right order. https://github.com/rust-lang/rust/issues/28160
That is not the standard question of right-to-left vs. left-to-right argument order. That is perfectly well defined: left to right. Rather, it's a very subtle question involving code nobody would write in practice.
> Except it wouldn't work, because Rust does not guarantee that drain destructor will be executed, in fact in perfectly safe code it may not be executed at all.
This is never a problem in real world code. The leakpocalypse affects nothing in the real world and was a lot of debate over what amounted to a very minor hole.
C++ has no guarantees about destructors being executed at all, and frequently due to memory management errors they aren't. Rust guarantees that they'll be executed unless you're leaking.
> Bugs, bugs and more bugs. Rust not calling your desctructor for variables in the same scope after panic, still there after more than a year: https://github.com/rust-lang/rust/issues/14875
C compilers have miscompilations too, with the same frequency. I never hit these in practice.
> I am still not sure if it is worth the effort, it seems to prevent problems that I don't commit in C++ anyway.
Yes, you do make those errors. Empirically. All large C++ projects I have ever seen have memory management errors, unless they're doing hugely expensive verification. I have not yet seen an exception.
> Running out of memory aborts program. This is I think quite a bad decision (it seems that this may be a temporary one) for a language that have exceptions in form of panic.
It's not a temporary one. Most programs don't need to handle out-of-memory conditions, and having the language do this is not a step back from C++. For programs that do, you can use libcore (recently stabilized!) and handle this yourself.
You're looking through the issue tracker, pulling out random bugs, and overstating their impact. Someone could do the same to any C++ compiler; LLVM has horrible-looking miscompilations all the time, and it's still production ready. Of the reasons not to use Rust, miscompilations (which is the vast majority of what you're talking about) aren't anywhere near the top of the list; they occur more or less with the same frequency they occur in C++. You can't complain that the borrow checker doesn't solve memory management issues you hit in C++ and then simultaneously criticize Rust by citing a whole bunch of issues that occur with much less frequency than those memory management issues.
We aren't changing anything you're talking about, except for bugs.
> In what order are subexpression evaluated in Rust? Unspecified yet, in fact it is even worse than that, it differs between borrow checkers (which I think uses the most useful one given Rust syntax: right to left behaviour), while code generation assumes left to right order. https://github.com/rust-lang/rust/issues/28160
That is not the standard question of right-to-left vs. left-to-right argument order. That is perfectly well defined: left to right. Rather, it's a very subtle question involving code nobody would write in practice.
> Except it wouldn't work, because Rust does not guarantee that drain destructor will be executed, in fact in perfectly safe code it may not be executed at all.
This is never a problem in real world code. The leakpocalypse affects nothing in the real world and was a lot of debate over what amounted to a very minor hole.
C++ has no guarantees about destructors being executed at all, and frequently due to memory management errors they aren't. Rust guarantees that they'll be executed unless you're leaking.
> Bugs, bugs and more bugs. Rust not calling your desctructor for variables in the same scope after panic, still there after more than a year: https://github.com/rust-lang/rust/issues/14875
C compilers have miscompilations too, with the same frequency. I never hit these in practice.
> I am still not sure if it is worth the effort, it seems to prevent problems that I don't commit in C++ anyway.
Yes, you do make those errors. Empirically. All large C++ projects I have ever seen have memory management errors, unless they're doing hugely expensive verification. I have not yet seen an exception.
> Running out of memory aborts program. This is I think quite a bad decision (it seems that this may be a temporary one) for a language that have exceptions in form of panic.
It's not a temporary one. Most programs don't need to handle out-of-memory conditions, and having the language do this is not a step back from C++. For programs that do, you can use libcore (recently stabilized!) and handle this yourself.
You're looking through the issue tracker, pulling out random bugs, and overstating their impact. Someone could do the same to any C++ compiler; LLVM has horrible-looking miscompilations all the time, and it's still production ready. Of the reasons not to use Rust, miscompilations (which is the vast majority of what you're talking about) aren't anywhere near the top of the list; they occur more or less with the same frequency they occur in C++. You can't complain that the borrow checker doesn't solve memory management issues you hit in C++ and then simultaneously criticize Rust by citing a whole bunch of issues that occur with much less frequency than those memory management issues.