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

Convenience syntax for module imports #108

wants to merge 3 commits into from
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -0,0 +1,36 @@
- Start Date: 2014-06-06
- RFC PR #: (leave this empty)
- Rust Issue #: (leave this empty)

# Summary

Add syntax sugar for importing the module itself along with some of its items.

# Motivation

The new syntax would make import clauses more concise.

# Detailed design

Instead of having to write:
use module::Type;
use module;
...the programmer could write:
use module::{self, Type};
The ```self``` keyword must be listed first in the list of items being imported and it refers to the module directly on its left. A syntax such as:
use module::self;
...should cause a compile-time error saying "Invalid syntax `use module::self;`. Use the syntax `use module;` instead."

# Drawbacks

This does complicate the language a miniscule amount.

# Alternatives

# Unresolved questions
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.