I think this is an interesting idea, and I definitely see the advantage. But I don’t think we should do it. 
A lot of the ergonomics features we’re considering come down to making the language more incremental to learn. Right now, users often have an experience of needing to learn a huge number of features all at once to understand how to write even basic Rust. So we’d like to be able to build sugar which makes the early stages of learning easier, so that they can gradually ease in to understanding the whole language.
This proposal is definitely along those lines - you can start learning Rust without learning about the main function. So why am I doubtful?
Any change like this has a cost associated with it as well. Since we can’t remove things from the language, adding an ergonomics feature necessarily increases the total number of things you have to learn about the language by the time you’re an “expert” Rust user. So there’s a trade off between making the ‘learning curve’ more gradual, and giving it a greater total height.
I think the gradiance this introduces is less beneficial than the total complexity it adds. The main function does not seem to me like a particularly huge step to have to ascend - you have to learn function syntax and that Rust starts by calling main. But this introduces a lot of complication:
- What do we do when there is both top-level expressions and a main function?
- Are items (not expressions) declared in a module with an implied main function visible outside of that module or not? This depends on if those items are ‘inside the main function’ or not.
- Can implied main functions exist in a crate with submodules or not?
- Can submodules have top-level expressions? (@repax suggests that they can be & they’d be called before main - to which I’d have to ask, in what order? That seems like a recipe for user confusion to me.)
Probably there are other questions I haven’t thought of as well.
I’m not saying we couldn’t answer all of these questions, and I don’t really have an opinion on what the answer would be. I’m saying that in exchange for not learning about main in their first 15 minutes, users eventually have to learn whatever answers we would come up with. I don’t think that trade off is worth it in this case.
I also think this introduces a tendency toward intermingling the item level and the expression level, a separation which is important to the layering of Rust.
For specific use cases like doctests and a repl, we can come up with specific solutions that aren’t at the language level.