Skip to content

Make sure importing a module never has side effects #105

@DylanSp

Description

@DylanSp

Importing a module should never have side effects (such as executing a print(); statement). This would allow Wheel programmers not to have to worry about import order of modules.

Consequences

  • Modules would need to only allow function declarations, class declarations, and imports at the top level. (Potentially, imports could be restricted to the top-level, which would make the cycle checker somewhat simpler; the parser could even add the import list to the parsed Module value (see type definition))
  • The program's entrypoint would have to be further narrowed down - presumably a main() function inside the Main module. (Potentially the main() function would be passed an args value using the Wheel LinkedList class, instead of the current import args from Args convention)
  • Exporting single values would be more difficult, though they could be exported as fields on an object.
  • Exported values should be immutable when imported: see Make sure imported objects are immutable #104.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions