-
Notifications
You must be signed in to change notification settings - Fork 6
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
Allow use
to import declarations into the current namespace, like in Rust
#25
base: master
Are you sure you want to change the base?
Conversation
Is the parent scope/module visible by default or do we have to use E.g., fn foo() = 42;
mod bar {
fn sup() {
let v = foo();
v
}
} |
No, but this is also the behavior of Rust actually... https://godbolt.org/z/MxqP15sEn I nonetheless have a patch that allows for this. I'm tempted to allow ourselves to diverge from Rust here, and allow for that, but we should probably discuss this on call or on Discord at least. |
Typically in rust you would just do a |
Seems like it is the standard in Rust, so I would say we stick to the default. |
Artic introduced module support a couple years ago, unfortunately it has not seen much adoption.
The oft-cited reason by would-be users is that this module support lacks the ability to import definitions into a namespace, which makes using declarations from others prohibitively verbose (at a minimum you must use a single-letter import like
A::
).This PR changes the use syntax to be closer to Rust's, which allow:
use A::*
use A::{b, c}