Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up(Modules) Tracking issue for the `mod.rs` changes #53125
Comments
Centril
added
B-RFC-approved
T-lang
C-tracking-issue
labels
Aug 6, 2018
Centril
referenced this issue
Aug 6, 2018
Closed
Tracking issue for RFC 2126: Clarify and streamline paths and visibility #44660
This comment has been minimized.
This comment has been minimized.
|
Of the various module changes, this one seems quite clear, uncontroversial, and ready to commit to. @rfcbot fcp merge |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Aug 6, 2018
•
|
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
rfcbot
added
proposed-final-comment-period
disposition-merge
labels
Aug 6, 2018
Centril
added this to the Rust 2018 RC milestone
Aug 6, 2018
This comment has been minimized.
This comment has been minimized.
sanmai-NL
commented
Aug 7, 2018
•
|
@joshtriplett: gave your post a thumbs down for the record, because you didn’t support your statement that it’s uncontroversial, while I can think of a few questions around this. Multiple equivalent module configuration mechanismsSo both Common submodules and module configurationWhat is clearer: A (now)
B (possibility after this change)
A possible limitation here is that directories and files are often sorted separately in IDEs (e.g., IntelliJ IDEA) and filesystem explorers (e.g., Gnome Files) so there may be a large visual gap between Non-code resources and module configuration
|
This comment has been minimized.
This comment has been minimized.
|
@sanmai-NL I didn't intend to suggest that there was unanimity, just that unlike some of the other module changes, there hasn't been widespread objection or disagreement, such as in the various edition feedback threads. Addressing your points specifically:
The intention is to primarily point people to
Today,
Depends on your interpretation of where the module lives. While some other languages do have facilities similar to More importantly, because of the inconsistency in the previous point, with today's system if you want to add a submodule to an existing module, you'd have to move the module to |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Aug 10, 2018
|
|
rfcbot
added
final-comment-period
and removed
proposed-final-comment-period
labels
Aug 10, 2018
This comment has been minimized.
This comment has been minimized.
|
I just want to report some experience trying this out. On a relatively small (4 relevant sub-modules) new crate for futures I used the new form exclusively. As a CLI only programmer I found the interference with tab completion to really break my workflow, enough so that I eventually gave up and reverted to the old form. |
This comment has been minimized.
This comment has been minimized.
|
@Nemo157 Could you elaborate a bit on the problems you experienced with tab completion? |
This comment has been minimized.
This comment has been minimized.
|
Just that when I have a folder structure including both I’m sure the new scheme is something I could learn to deal with better, but after a few days of working on that crate I was still regularly accidentally opening the folder instead of the file I wanted. |
This comment has been minimized.
This comment has been minimized.
|
@Nemo157 Thanks for the data point! This does sound a bit concerning and I could see a lot of folks (myself included) being slowed down by this. I skimmed the RFC discussion and I couldn't find any mention of this issue, so it seems it wasn't addressed there. On the other hand, having multiple files named If the strategy here was to deprecate |
This comment has been minimized.
This comment has been minimized.
|
I feel like tab completion is more important to me than the tab titles in vim in my workflow... |
This comment has been minimized.
This comment has been minimized.
|
Counterpoint: In my workflow I very rarely have to type file paths manually (why would I do that?) but very often look at them in editor tabs. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, this seems like a very editor-dependent experience. It seems like, in this respect at least, the new style can make things easier for some tabbed-IDE users, while making things a bit harder for VIM (etc) folks. |
This comment has been minimized.
This comment has been minimized.
|
That seems to suggest that we should keep both and make neither canonical. |
This comment has been minimized.
This comment has been minimized.
|
@mark-i-m AFAIK the plan was always to keep both. |
This comment has been minimized.
This comment has been minimized.
|
I'm not sure how much vim differs from emacs but the problem of having many mod.rs, as well as having to rename and move modules is as present in emacs as it is in vscode for me. I agree there can be some friction with path completion. It goes away when using project-wide find-file commands and/or fuzzy matching (like helm-projectile-find-file in spacemacs) though. |
This comment has been minimized.
This comment has been minimized.
sanmai-NL
commented
Aug 16, 2018
|
@mark-i-m, @cramertj: Strongly disagree! What about the added complexity of two ways to achieve the same thing? See #53125 (comment). Not that I care so much about how we configure module structure in Rust, but I do care about keeping the language as simple as possible. Having multiple module configuration mechanisms contravenes Rust’s strategic policy (e.g., https://blog.rust-lang.org/2017/03/02/lang-ergonomics.html):
How to teach to novices: ‘oh, there a |
This comment has been minimized.
This comment has been minimized.
sanmai-NL
commented
Aug 16, 2018
|
People are mentioning issues with various IDEs/editors, but we are barking up the wrong tree. The Rust refactoring feature set of these tools must be improved then. Not how Rust is designed. |
This comment has been minimized.
This comment has been minimized.
I was very careful not to mention any editor, my issues were mainly around accessing the files directly from a shell (and an editor command buffer with very similar completion to mainstream shells). While it might be possible to integrate RLS into my shell to be able to open files via module-name completion or something, that's not something I'm planning on doing anytime soon. |
This comment has been minimized.
This comment has been minimized.
|
What if deprecate #[path = "mymod/mod.rs"]
pub mod mymod;if somebody wants to keep all files related to the module in one place? |
This comment has been minimized.
This comment has been minimized.
|
I'm personally quite torn on what I'd use in my own projects given the choice of both. On one hand, My conclusion is that we shouldn't solve this globally for all Rust users because work flows are so different. The addition of |
This comment has been minimized.
This comment has been minimized.
|
Shall |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Aug 20, 2018
|
The final comment period, with a disposition to merge, as per the review above, is now complete. |
rfcbot
added
finished-final-comment-period
and removed
final-comment-period
labels
Aug 20, 2018
This comment has been minimized.
This comment has been minimized.
|
Given that the FCP is now complete; any takers for writing up a stabilization PR? |
This comment has been minimized.
This comment has been minimized.
sanmai-NL
commented
Aug 22, 2018
|
@Centril, |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@sanmai-NL with respect to process, we are, unfortunately, under time constraints to ship the edition so we may sometimes speed up the process more so than normally done. However, this does not mean that decisions should be rushed just because of time constraints. That said, this has already been extensively discussed on the RFC before it. The main decision to accept this was made there and then, this is simply confirming the decision as part of our double-checking and vetting process. As for your concern about teachability, where you wrote:
as well as:
@joshtriplett said:
I believe this addresses your point. At least it suffices for me. I would also like to add that Rust's language team does not generally adhere to PEP 20 -- The Zen of Python:
We sometimes do adhere to this, we sometimes don't, depending on the situation. :) |
This comment has been minimized.
This comment has been minimized.
|
This was proposed previously in an RFC, the RFC was accepted, the result was implemented, this change was widely discussed as part of the edition, and quite a bit of feedback already happened during that long process. The previous tracking issue incorporated plenty of discussion as well. No part of the process has been bypassed here; if anything, this change has had closer scrutiny and more extensive feedback than usual. |
This comment has been minimized.
This comment has been minimized.
sanmai-NL
commented
Aug 23, 2018
|
@Centril: as for PEP 20-like principles. It seems to me teachability and simplicity haven’t been prioritized in Rust. Please note: not being prioritized does not mean being ignored completely. I deeply regret that. Here is another case where with deliberation and specific attention to teachability and simplicity (two separate but related concerns) would makes us conclude rust-lang/rfcs#2126 is not ‘uncontroversial’ at all. |
This comment has been minimized.
This comment has been minimized.
sanmai-NL
commented
Aug 23, 2018
•
|
@Centril, @joshtriplett: thanks, your explanations answer my question. Note that I didn’t claim parts of the process have been bypassed, I just observed how quickly things seemed to go when you do not know the process that it seems to have went through. @joshtriplett: In hindsight you entering the thread stating this ‘seems uncontroversial’ and ‘ready to commit to’, suggested this is not just about implementing what has been firmly decided. |
This comment has been minimized.
This comment has been minimized.
|
@sanmai-NL Fair enough. In hindsight, I could have laid out some of the history more explicitly; in fact, I think it makes sense to edit in the explanations of that history near the top of the thread. By "ready to commit to", I meant "ready to get on a path to stabilization as part of the edition". |
This comment has been minimized.
This comment has been minimized.
|
So, as discussed, this is ready for stabilization. This is a great candidate for first PRs! The stabilization guide page on forge gives instructions on how to proceed. |
nikomatsakis
added
the
E-mentor
label
Sep 1, 2018
This comment has been minimized.
This comment has been minimized.
|
Also, we should touch base with the @rust-lang/docs team: what is needed around documentation here? |
This comment has been minimized.
This comment has been minimized.
|
Changes in the books and in the examples I assume. Bad luck that a few members of the docs team aren't available currently... |
This comment has been minimized.
This comment has been minimized.
|
I will take this for my first PR |
blitzerr
added a commit
to blitzerr/rust
that referenced
this issue
Sep 9, 2018
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Sep 12, 2018
blitzerr
added a commit
to blitzerr/rust
that referenced
this issue
Sep 12, 2018
This comment has been minimized.
This comment has been minimized.
|
Triage: The only thing remaining now is to update the reference / documentation. |
This comment has been minimized.
This comment has been minimized.
Done! |
steveklabnik
closed this
Sep 16, 2018
steveklabnik
reopened this
Sep 16, 2018
This comment has been minimized.
This comment has been minimized.
|
Oops, mis-read. This is ready to stabilize. |
This comment has been minimized.
This comment has been minimized.
|
@steveklabnik I believe this was already stabilized in the compiler :) Closing this issue; we can track the remaining work in the issues you've listed. |
Centril commentedAug 6, 2018
•
edited
This is a sub-tracking issue for the RFC "Clarify and streamline paths and visibility" (rust-lang/rfcs#2126)
dealing with the
mod.rschanges.Unresolved questions:
None
Summary
A
foo.rsandfoo/subdirectory may coexist; mod.rs is no longer needed when placing submodules in a subdirectory.