4 ms·
Now I haven't programmed enough rust to know if there's a real problem here, but I worry about things like NLL. It means that the borrower checker accepts more
by kybernetikos 9y ago
Now I haven't programmed enough rust to know if there's a real problem here, but I worry about things like NLL. It means that the borrower checker accepts more programs which is good, but it also means that the model you need to have of its behaviour to correctly predict how it acts is a bit more complex. There's a trade off there.
- foota 9y agoI would argue that it's actually the opposite. To understand how borrows work right now takes more understanding of how the checker operates than with non lexical lifetimes.
- tinco 9y agoThe code in the compiler is more complex, but the domain is now more fully covered, so there is less understanding needed for the programmer. It now simply understands your intention, where before it would not. So previously you would write some code, be surprised that it does not compile, gain a thorough understanding of the limits of the borrow checker, write a workaround to appease the checker. Now you write the code, expecting it to be correct, and the borrow checker will agree.
- kybernetikos 9y ago> It now simply understands your intention, where before it would not. So previously you would write some code, be surprised that it does not compile, gain a thorough understanding of the limits of the borrow checker Much more important than it understanding your intention is you understanding its limits. If it understands your intention 10% more of the time, but it's harder for you to understand what's going on when it doesn't, then that is not something everyone is going to find simpler. Another word that gets applied to systems that try to guess at your intentions rather than operate according to an easily predictable model is 'magic'.
- tinco 9y agoYou would be right if it did guess, but it doesn't. It's not magic, I'm not sure if it still has limitations, but I think the idea is that it eventually does not have limitations. It's not magic when a compiler compiles your correct code.
- dbaupp 9y agoThat's definitely a fair concern, and smarter=more complex is something the Rust team seems to be aware of, e.g. for that specific feature https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md#how-we-teach-this https://github.com/rust-lang/rfcs/blob/master/text/2094-nll....