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

Add the keyword trusted for specifying "friend modules" #47

Merged
merged 2 commits into from Apr 22, 2014
Merged

Add the keyword trusted for specifying "friend modules" #47

merged 2 commits into from Apr 22, 2014

Conversation

ghost
Copy link

@ghost ghost commented Apr 16, 2014

No description provided.

@@ -1,25 +0,0 @@
- Start Date: (fill me in with today's date, YYYY-MM-DD)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving the template shouldn't be part of the commit. You're supposed to copy it, edit your copy, and add the copy to the commit.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how GitHub works. I simply tried to follow this guide to a T.

I can find a guide for creating a new file and moving a file, but not for copying a file at:
https://help.github.com/categories/81/articles

@brson brson merged commit 95acc3b into rust-lang:master Apr 22, 2014
@brson
Copy link
Contributor

brson commented Apr 22, 2014

This was discussed in today's meeting: https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-04-22#friend-modules---rfc-47

Friend modules have been considered before, and current consensus is that Rust provides enough tools for encapsulation that friend visibility is rarely needed. In particular, pub use can do a lot of what friend visibility does.

We may need to revisit friend visibility at some point in the future, but not now.

I've closed this, assigned it RFC 10, but not accepted. Thank you for your time.

@rainbow-alex
Copy link

Is it too soon to reconsider this? There are some useful things pub use can't achieve.
http://www.reddit.com/r/rust/comments/27fvkp/q_dont_expose_field_but_allow_incrate_usage/

A possible alternative to trusted: a new privacy modifier crate pub, which acts like pub but is never exposed outside the crate. Pretty straight-forward rule, allows fine-grained control, and does not introduce new keywords.

Both solutions are backwards compatible, so not strictly necessary for 1.0. However I would argue that visibility trumping sense when it comes to module layout is an issue. It could certainly lead to awkwardly designed crate layouts, which in turn might be a BC problem after all.

pcwalton added a commit that referenced this pull request Sep 11, 2014
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

Successfully merging this pull request may close these issues.

4 participants