5 ms·
I can imagine a future in which AI analyses C++ and makes it memory safe. Also, AI assistance will make it alot easier to get stuff done in Rust.
by andrewstuart 4y ago
I can imagine a future in which AI analyses C++ and makes it memory safe.
Also, AI assistance will make it alot easier to get stuff done in Rust.
- thesuperbigfrog 4y ago>> I can imagine a future in which AI analyses C++ and makes it memory safe. Equivalent algorithms are built into the Rust compiler. Tracking the lifetime of a variable and ensuring that the underlying resources are properly managed does not require artificial intelligence, just good bookkeeping.
- brundolf 4y agoThere are memory-safe programs that the borrow checker will not let you write because of its limitations (and this will always be true, no matter how smart it gets, and is true of any static type system or checker). This is a conscious tradeoff you make by using the language. It's also why unsafe blocks exist- not so you can intentionally make memory errors, but so you can attempt to safely work around the borrow-checker's limitations
- thesuperbigfrog 4y ago>> This is a conscious tradeoff you make using the language, and it's also why unsafe blocks exist Agreed. Unsafe Rust is needed to handle specific use cases. However, unchecked / unsafe blocks are not needed most of the time and should be used sparingly and judiciously.
- tialaramex 4y agoA future where humans write C++ but then the machine makes it memory safe seems extremely unlikely. Global analysis of non-trivial software is crazy hard. Like, if you have the future tech in a SF novel doing this, there's a fair chance that's the most unrealistic part of the story unless they also have FTL travel. I'd say it's more likely that a future AI can write perfectly good C++ but, to soothe the poor C++ superfans it will let them type nonsense into a window for a while, then "analyse" their program and substitute one it wrote that's correct. This doesn't involve solving any intractable problems, just confidently presenting a lie.
- justin66 4y agoWhat is the distinction you're drawing below? > A future where humans write C++ but then the machine makes it memory safe seems extremely unlikely. > I'd say it's more likely... it will let them type nonsense into a window for a while, then "analyse" their program and substitute one it wrote that's correct.
- tialaramex 4y agoThe distinction is between successfully understanding an arbitrary program, which we know is not practical, versus just throwing away the human's program and substituting a correct program the machine wrote to solve this problem, which is tractable. I'm assuming we're telling the machine what the program is for, if we're not it can't analyse anything, maybe my program is supposed to spit out the first million primes, then six more large numbers which aren't prime, and then segfault.
- HybridCurve 4y agoIt's much more practical to build memory safety into the language than try to invent a system that is capable of policing logic employing liberal memory access. There were some comments by Bjarne Stroustrup I read the other day that made me believe C++ was not in a hurry to move in that direction.