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

Include name collision avoidence #55

Open
Woccz opened this issue Jun 15, 2021 · 2 comments
Open

Include name collision avoidence #55

Woccz opened this issue Jun 15, 2021 · 2 comments
Labels
backlog Good idea but bad effort to value ratio right now enhancement New feature or request nolol Issues only regarding NOLOL

Comments

@Woccz
Copy link
Contributor

Woccz commented Jun 15, 2021

I think, similar to Python, when a library is included, all of its macros should have to be called with myLib.myMacro(x).

Further, from "myLib" include myMacro functionality, like Python, could be added, which imports a single macro from the given library, while being able to use myMacro(x), rather than using myLib.myMacro(x).

Thirdly, again like Python, an as keyword could be added to avoid naming collisions, include "myLib" as aLibrary, or from "myLib" include myMacro as aMacro.
These would then be usable as aLibrary.myMacro(x) and aMacro(x) respectively.

Of course, this is not a pressing issue, but if it is not too difficult to implement, I believe it would be helpful for code and collision management.
This would, for example, allow the "std/math" macros to be simply be defined as their macro names, and included as math.<macro name>, for example, math_floor could be implemented as

macro floor(x) expr
    ...
end

and be called with math.floor(x), or simply floor(x) if included with from "std/math" include floor

Thank you.

@Woccz Woccz added the enhancement New feature or request label Jun 15, 2021
@Woccz Woccz changed the title Import name collision avoidence Include name collision avoidence Jun 15, 2021
@dbaumgarten dbaumgarten added the nolol Issues only regarding NOLOL label Jun 15, 2021
@dbaumgarten
Copy link
Owner

While that's absolutely a reasonable suggestion, it would make the whole include-logic a lot more complicated.
I was just to lazy to do it "properly" ^^.
Also while that's simple and logical for macros and definitions, it could feel strange for included code that is not part of a macro.

Namespaced imports will come somewhen in the future. But currently there is simply not enough includable-code to cause major collision-issues and the "filename_"-convention works good enough.

Therefore: backlog

@dbaumgarten dbaumgarten added the backlog Good idea but bad effort to value ratio right now label Jun 15, 2021
@Woccz
Copy link
Contributor Author

Woccz commented Jun 15, 2021

Yes, definitely a backlog change.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Good idea but bad effort to value ratio right now enhancement New feature or request nolol Issues only regarding NOLOL
Projects
None yet
Development

No branches or pull requests

2 participants