So, on the overall proposal: this new direction took me a bit by surprise, but my initial reaction is that it’s brilliant and daring. After reading a lot of the prior discussion, I think I have come to agree that one of the crucial sources of confusion in today’s module system is the distinction between absolute and relative paths. I think you are right to take square aim at that distinction – and I’m glad that checkpoints gives us the ability to do so.
I often think about something @wycats once told me about how he teaches today’s module system. Basically, he said something like: he teaches that paths are used to name things in the file, and
use is used to bring things from other files into scope. This is not 100% right, but it’s close.
I like that this proposal makes a similar clear distinction about inside and outside the crate. In short, in this proposal, paths are about naming things from inside the crate, and
from is about bringing in things from other crates. We no longer have to teach about “paths in use vs other paths” since everything is relative to the current file. That feels clear to me.
What I don’t yet know is how it will feel in practice, I think. For example, here is something that often happens to me:
- I write in some fn
std::cmp::min(...). This gets a compilation error.
- I get a bit confused, then remember, and write
::std::cmp::min(..). This is kind of ugly.
- I give up and write a
use std::cmpand then
This seems to highlight some of the good and bad of the proposal in practice. For example, I can no longer write an “inline” reference to another crate anyway. I’m also going to be using a lot more absolute paths, which I still find kind of an eye-sore, but maybe I’ll get used to it – and I suspect that they will look better all collected together in a
use. This is probably something we can fix by turning some knobs, anyway.
OK, I got to run, that’s all I have time for for now. =)