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

CE: Add support for aliasing imported libraries #1366

Closed
thron7 opened this issue Feb 25, 2020 · 2 comments
Closed

CE: Add support for aliasing imported libraries #1366

thron7 opened this issue Feb 25, 2020 · 2 comments

Comments

@thron7
Copy link

thron7 commented Feb 25, 2020

Importing the same symbol from two different libraries (like eval) requires you to fully qualify one of them, in order to disambiguate them. This can become tedious with long module names.

To relief that it would be helpful to assign aliases to modules on import, e.g. like import demo::lang::Exp::Concrete::WithLayout::Syntax as ConSyn; and later refer to the contained symbol Exp as ConSyn::Exp rather than demo::lang::Exp::Concrete::WithLayout::Syntax::Exp.

This is basically the same suggestion as in #775 .
Reference: https://stackoverflow.com/a/60186392/127465

@jurgenvinju
Copy link
Member

It makes total sense.

There is another feature which is a bit similar already present, module resources, but it does not have exactly the same functionality of providing an abbreviation in the local module scope. This feature generates a module with a given name at compile time. I think we have to consider module aliases with this feature in mind, and also the design of type aliases should be consistent.

It is currently possible to use type aliases as a (weak) workaround; say:

alias ConSynExp = demo::lang::Exp::Concrete::WithLayout::Syntax::Exp;

But you'd have to do that for every type you want to use in the module :-(

@jurgenvinju
Copy link
Member

Let's leave this as a duplicate of #775 with these additional comments. We've a language design freeze until the compiler bootstraps, so it might take a few months before we start discussing this one again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants