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

Enable bracket syntax for from [xyz, abc] import nil #162

Closed
awr1 opened this issue Aug 22, 2019 · 2 comments
Closed

Enable bracket syntax for from [xyz, abc] import nil #162

awr1 opened this issue Aug 22, 2019 · 2 comments

Comments

@awr1
Copy link

awr1 commented Aug 22, 2019

In Nim, you can import multiple modules in concisely as:

import std / [sequtils, parsexml]

However, you cannot do the same using the from syntax, (particularly if you want fully qualified imports on multiple modules) which I feel is not consistent, e.g.

from std / [sequtils, parsexml] import nil # error!

If others agree with adding this, unfortunately this will require a bit of a grammar change, (although nothing too drastic in my opinion) because:

importStmt = 'import' optInd expr
              ((comma expr)*
              / 'except' optInd (expr ^+ comma))
fromStmt = 'from' moduleName 'import' optInd expr (comma expr)*
@timotheecour
Copy link
Member

duplicate of #76 (proposal 1); see also its proposal 2 (which is a compatible addition to proposal 1)
proposal 1 is actually easy to implement IIRC

@awr1
Copy link
Author

awr1 commented Aug 23, 2019

Will close as a duplicate of #76.

@awr1 awr1 closed this as completed Aug 23, 2019
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

2 participants