ghost
ghost copied to clipboard
Refine imports and remove side effects
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"