Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename one of sync::Mutex or sync::mutex::Mutex #15724

Closed
SimonSapin opened this issue Jul 16, 2014 · 6 comments
Closed

Rename one of sync::Mutex or sync::mutex::Mutex #15724

SimonSapin opened this issue Jul 16, 2014 · 6 comments

Comments

@SimonSapin
Copy link
Contributor

They currently have very different semantics: the former is a lock-protected container while the latter is only a lock. I just spent a few minutes very confused, looking at the docs for one of them to understand code using the other.

Combined with #15723 and libstd-as-a-facade (many items with the same name documented in different modules are in fact the same item), this really brings down the doc’s usability.

sync::Mutex vs sync::mutex::Mutex is just the example I hit today, but same-name-but-different items is a pattern we should avoid in general.

@thestinger
Copy link
Contributor

I think using the same name for both is fine as long as the paths leading up to it make it clear that one is a low-level mutex for unsafe code and the other is a high-level abstraction.

@SimonSapin
Copy link
Contributor Author

@thestinger, sync::Mutex vs sync::mutex::Mutex does not convey this at all, IMO. Worse, it is relatively common to reexport at the crate top-level things that are defined in modules: exactly the same naming pattern with a very different meaning.

@thestinger
Copy link
Contributor

I realize that, I'm saying that it would be fine if the paths were better.

@SimonSapin
Copy link
Contributor Author

I was gonna suggest that sync::mutex could move to sync::raw::mutex, but I just found out that sync::raw::Mutex is yet another different type…

@huonw
Copy link
Member

huonw commented Sep 16, 2014

#14530

@aturon
Copy link
Member

aturon commented Jan 17, 2015

This issue is no longer relevant after the sync overhaul.

@aturon aturon closed this as completed Jan 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants