Skip to content

Refine imports and remove side effects #107

@kaidesu

Description

@kaidesu

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions