The more I write Rust, the more modules I have, and the more I think that the implicit modules proposal here would be really nice [*].
Still, my learning curve for modules was high, because they were already to implicit (when I say mod x, how does the compiler know where to look?). I think implicit modules would have made it even harder (sometimes I need to write mod, sometimes I don’t, plus the magic of the compiler knowing where to look).
So while I think this is a nice productivity improvement for those that do know the language, I would like this to be coupled with better error messages for those who are learning it. Implicit is awesome as long as it does what you want/expect. When it doesn’t, there is no code anywhere that you can “debug” to find out what’s going wrong “because that logic is implicit”.
My point being, I would like to hear what we can do to improve the experience when things do not work as an user expect (e.g. typo in the name of a module file without a mod declaration anywhere in the program).
[*] My only concern of making the module system more implicit is that we are kind of making the filesystem (or some meta file system) part of Rust the language. If we are ever going to produce a spec, this might result in a lot of “implementation defined”-speak to avoid having to define what a filesystem, paths, … actually are (there are a lot of weird platforms out there). We are probably implicit enough already for this to be unavoidable, but maybe it is worth it to think about how would one specify this in a filesystem agnostic way.