Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

(Modules) Tracking issue for the mod.rs changes #53125

Closed

Description

@Centril

This is a sub-tracking issue for the RFC "Clarify and streamline paths and visibility" (rust-lang/rfcs#2126)
dealing with the mod.rs changes.

Unresolved questions:

None

Summary

A foo.rs and foo/ subdirectory may coexist; mod.rs is no longer needed when placing submodules in a subdirectory.

Activity

  1. added
    B-RFC-approved
    T-lang
    C-tracking-issue
    on Aug 6, 2018
  2. joshtriplett commented on Aug 6, 2018

    @joshtriplett
    Member

    Of the various module changes, this one seems quite clear, uncontroversial, and ready to commit to.

    @rfcbot fcp merge

  3. rfcbot commented on Aug 6, 2018

    @rfcbot

    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.

  4. added
    proposed-final-comment-period
    disposition-merge
    on Aug 6, 2018
  5. added this to the Rust 2018 RC milestone on Aug 6, 2018
  6. sanmai-NL commented on Aug 7, 2018

    @sanmai-NL
    Contributor

    @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 mechanisms

    So both foo/mod.rs and foo.rs are going to be supported? I wouldn’t look forward to that. From a teachability perspective, the possibility of two ways to do the same thing even if one way is perhaps more straightforward is not an improvement. The newer, easier way will perhaps not be reflected in the ecosystem for some time to come so new programmers will not necessarily be inclined to use the newer, easier way.

    Common submodules and module configuration

    What is clearer:

    A (now)

    foo/mod.rs
    foo/tests.rs
    

    B (possibility after this change)

    foo.rs
    foo/tests.rs
    

    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 foo.rs and its related foo/.

    Non-code resources and module configuration

    include_bytes! and include_str! look up resources relative to the current module’s directory. This means a mod.rs-like config would perhaps be clearer, similar to example B in my previous point.

  7. joshtriplett commented on Aug 7, 2018

    @joshtriplett
    Member

    @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:

    Multiple equivalent module configuration mechanisms

    The intention is to primarily point people to foo.rs. We want to keep foo/mod.rs for compatibility, so this change doesn't break existing projects. And we can provide appropriate lints (for people who want to write idiomatic Rust 2018 code) that encourage renaming the files accordingly, to help migrate the ecosystem. So I wouldn't expect this to bifurcate the ecosystem.

    Common submodules and module configuration

    Today, foo::bar could map to either foo/bar/mod.rs or foo/bar.rs depending on whether it has submodules. Similarly, foo::bar::baz maps to foo/bar/baz.rs or foo/bar/baz/mod.rs. That inconsistency makes it more difficult to look at a path in code and map it to the filesystem. So, I'd suggest that it's clearer to look at foo::bar and always know that you just mentally map each :: to / and append .rs.

    Non-code resources and module configuration

    Depends on your interpretation of where the module lives. While some other languages do have facilities similar to mod.rs, most tend to put code associated with a module named "foo" in a file foo.ext, and when that file includes something it would do so relative to the directory containing that file. This is a subjective difference.

    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 mod.rs, which would then change the location that include_bytes! and similar start from. With this change, you don't have to move the file to add submodules, so those paths always consistently start from the same place.

  8. rfcbot commented on Aug 10, 2018

    @rfcbot

    🔔 This is now entering its final comment period, as per the review above. 🔔

  9. added
    final-comment-period
    and removed
    proposed-final-comment-period
    on Aug 10, 2018
  10. Nemo157 commented on Aug 15, 2018

    @Nemo157
    Contributor

    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.

  11. Centril commented on Aug 15, 2018

    @Centril
    ContributorAuthor

    @Nemo157 Could you elaborate a bit on the problems you experienced with tab completion?

  12. 24 remaining items

  13. sanmai-NL commented on Aug 23, 2018

    @sanmai-NL
    Contributor

    @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.

  14. joshtriplett commented on Aug 23, 2018

    @joshtriplett
    Member

    @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".

  15. nikomatsakis commented on Sep 1, 2018

    @nikomatsakis
    Contributor

    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.

  16. added
    E-mentor
    on Sep 1, 2018
  17. nikomatsakis commented on Sep 1, 2018

    @nikomatsakis
    Contributor

    Also, we should touch base with the @rust-lang/docs team: what is needed around documentation here?

  18. GuillaumeGomez commented on Sep 1, 2018

    @GuillaumeGomez
    Member

    Changes in the books and in the examples I assume. Bad luck that a few members of the docs team aren't available currently...

  19. blitzerr commented on Sep 3, 2018

    @blitzerr
    Contributor

    I will take this for my first PR

  20. added a commit that references this issue on Sep 12, 2018
  21. Centril commented on Sep 15, 2018

    @Centril
    ContributorAuthor

    Triage: The only thing remaining now is to update the reference / documentation.

  22. steveklabnik commented on Sep 16, 2018

    @steveklabnik
    Contributor
  23. steveklabnik commented on Sep 16, 2018

    @steveklabnik
    Contributor

    Oops, mis-read. This is ready to stabilize.

  24. Centril commented on Sep 18, 2018

    @Centril
    ContributorAuthor

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    B-RFC-approvedC-tracking-issueE-mentorT-langdisposition-mergefinished-final-comment-period

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions