4 ms·
You couldn't write explicit lifetimes before NLL, either. (Nor does conventional type inference mean you can always write the type! This is why people who desig
by Rusky 3y ago
You couldn't write explicit lifetimes before NLL, either. (Nor does conventional type inference mean you can always write the type! This is why people who design type systems care about "principal types.")
NLL (and even moreso Polonius) brought the borrow checker closer to how programmers reason about lifetimes in their head than it was before, empirically speaking. The thing you described was a worry at the time but it never turned out to be accurate.
If there is anything about the borrow check that does match your description, it is things like "borrow splitting" and mutable reborrows, which can be done locally but are not expressible in function signatures. These problems existed long before NLL, though, and don't have anything to do with syntax or lexical scope.
- lmm 3y ago> You couldn't write explicit lifetimes before NLL, either. Well, no, but you can write scopes explicitly, and all your lifetimes correspond to scopes, by definition. > NLL (and even moreso Polonius) brought the borrow checker closer to how programmers reason about lifetimes in their head than it was before, empirically speaking. The thing you described was a worry at the time but it never turned out to be accurate. It worked for how some programmers reason about lifetimes in their head. Not for me. Maybe I'm the minority.