-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Inherit use #38
Inherit use #38
Conversation
This sounds like a reasonable idea. What about extern crates? Those are only in-scope in the crate file. Would we have |
I haven't decided if I like or dislike this idea, but I think it would be better to use an attribute like |
my variation of this suggestion would have been
i would guess 'inherit' as default wouldn't be a problem in terms of 'over-visibility', wouldn't the more 'fine-grain' use's be further down the module graph anyway; and if you really need isolation/decoupling of a module for re-useability, you can make a crate instead |
I'm not sure if I like using attributes for something as fundamental as On Tue, Apr 8, 2014 at 5:16 AM, dobkeratops [email protected]:
|
|
||
# Motivation | ||
|
||
When using non-std crates, and ubiquitous data structures, it can becomes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/can//?
I'm in the same position as @thestinger I'm not sure whether I like it or not, although it seems useful. I'll put more thoughts on this. |
I don't like losing keywords either. Maybe it's time we start introducing context-sensitive keywords? |
As far as the keyword goes, I don't like |
"virtual use" and "abstract use" sound terrible and are meaningless, to me. On Tue, Apr 8, 2014 at 3:42 PM, Nick Cameron [email protected]:
|
i was going to suggest 'super use' , even though its kind of the opposeite of super's meaning in scope. |
#[heritable] On Tuesday, April 8, 2014, dobkeratops [email protected] wrote:
|
@nick29581 What about |
cascade is something I could get behind. On Tue, Apr 8, 2014 at 7:45 PM, Eric Summers [email protected]:
|
are glob imports still buggy.. does 'use super::*' bypass the need for inherit use? is it too "indiscriminate" ? I dont think it would be any harder to teach or more cluttering, vs another keyword. |
It seems a bit indiscriminate. It will pull in everything from super, not just the use declarations. And in fact it won't even pull in non- I could see turning this around and having it be some Thinking about this RFC a bit more, my biggest concern is that this makes it harder to figure out where a name came from in a child module. Normally you can just search the file to find the top element of any referenced path (with globs being the only exception, but that's feature-gated), but this proposal decouples it so you have to look outside the current module up to all the parents. I don't know how important this actually is, though. And it's not even a strict rule today; macros (and syntax extensions) don't have corresponding Of course, if we do plan on un-feature-gating globs at some point, then this becomes much less of an issue. I don't know what the long-term plan there is. |
so at the minute the 'common.rs' use common::* is the best way to get a load of common uses i guess, |
Consider myself among those who are concerned about rampant keyword proliferation. I'm not sure this is entirely warranted (hooraaaay, more complexity in the module system!), but if it is, let's do it via an attribute if possible. That said, I'm more interested by #37, if that would obviate the desire for this. |
I'm more in favor of #37 than this, but I think this is also useful. |
Closing as postponed, we think that something like this can be added backwards compatibly. |
Adding my thoughts here because they're not well-developed enough yet to warrant a separate discussion: Just in terms of basic intuition, I naturally expect inner scopes ( I.e., to illustrate:
The direct, worse-is-better approach would be to just go ahead and make it so: modules get to see definitions from ancestor modules within (and only within) the same file. However, I don't think the module system itself has any logical concept of "a file", only the implementation does. So a slightly more sophisticated answer would be to have two different kinds of modules, those which see definitions from outer scopes, and those which don't. For the sake of discussion (I don't really like these names), call them
Is this even possible? I don't think it is. Or should be. |
2 small tests for fuse
No description provided.