X Tutup
The Wayback Machine - https://web.archive.org/web/20201201020341/https://github.com/leafo/moonscript/issues/413
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

Feature request: Renaming imports, import X as Y from Z #413

Open
Lixquid opened this issue Apr 8, 2020 · 0 comments
Open

Feature request: Renaming imports, import X as Y from Z #413

Lixquid opened this issue Apr 8, 2020 · 0 comments

Comments

@Lixquid
Copy link

@Lixquid Lixquid commented Apr 8, 2020

Currently, the import statement works really well for bringing in stuff into local scope, but an issue arises if two things you want to import have the same name:

import GetAll from player
import GetAll from ents
local GetAll
GetAll = player.GetAll
GetAll = ents.GetAll -- ouch, goodbye player.GetAll

Ideally, some small piece of optional syntax could be used to denote the name that the particular item would have in the following scope; import GetAll as eGetAll from ents.

Thoughts would be appreciated.

Edit:

As with the original import statement, there is a way around this with table comprehensions:

import a from b
{:c} = d
{e: eFromF} = f
local a
a = b.a
local c
c = d.c
local eFromF
eFromF = f.e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.
X Tutup