3 ms·
Time to rewrite Java in Rust.
by ianamartin 8y ago
Time to rewrite Java in Rust.
- dtech 8y agoI know it's a (bad) joke, but Rust wouldn't solve this. This is incorrectly implemented logic and Rust will not prevent you from doing that.
- kibwen 8y agoTo be marginally less facetious, Rust would "fix" this problem by dint of deliberately neither having a ++ operator (in either post- or pre-increment varieties) nor by allowing assignment operators (including augmented assignment ops) to evaluate to the value of their RHS, so the example from the OP would have to be written in a different fashion. :P (Rust has previously had bugs of its own related to the evaluation order of += and friends, it seems like a problem that nearly every language has at some point...)
- Dylan16807 8y ago> neither having a ++ operator The bug happens with a function call on the LHS too. > nor by allowing assignment operators (including augmented assignment ops) to evaluate to the value of their RHS I'm confused. The assignment is happening last, and whatever it evaluates to is being discarded. How would changing what it evaluates to do anything? But more importantly, the comment was about implementing Java itself in Rust, not the broken function, and that is why it wouldn't change anything.
- kjeetgill 8y agoIt'll never happen. They're too busy rewriting Java in Java! See: substrateVM, graal