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

Refine imports and remove side effects #107

Open
kaidesu opened this issue Feb 9, 2022 · 0 comments
Open

Refine imports and remove side effects #107

kaidesu opened this issue Feb 9, 2022 · 0 comments

Comments

@kaidesu
Copy link
Member

kaidesu commented Feb 9, 2022

Side effects should be considered a code smell - currently, when importing a module, if it is not specified what you want from the module, it will effectively load and execute the module without binding anything to the current scope. I don't really like this, so instead it should just default to assigning everything to a new variable of the same "name":

import "math" // import and assign to the variable "math" by default

print(math.pi)
import "math" as m // import and assign to the variable "m"
import pi from "math" // import only "pi" and assign to variable "pi"
import pi, e, tau from "math" // import only "pi", "e", and "tau" and assign to their respective variables
import abs as absolute from "math" // import only "abs" and assign to variable "absolute"
@kaidesu kaidesu added this to the v1.0 Beta 2 milestone Feb 9, 2022
@kaidesu kaidesu self-assigned this Feb 9, 2022
@kaidesu kaidesu removed their assignment Oct 27, 2023
@kaidesu kaidesu removed this from the v1.0 Beta 2 milestone Oct 27, 2023
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

1 participant