Documentation

ImportGraph.Tools.MinImports

#min_imports #

This module provides #min_imports, which minimizes the imports according to which are actually used in the declarations and syntax of the current file. It respects module-system relevant dependencies.

Note: testing #min_imports should not use #guard_msgs, as #min_imports reports back from the end of the file. Instead, this file exposes logAllMinImports and resetMinImports for testing.

Future work #

Old #min_imports infrastructure #

Does not work within the module system. Get the names of all needed imports.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Modern #min_imports #

    Minimize the imports of the entire current module in the module system.

    This command may be written anywhere in the file, and will still take into account the whole file. As such, the command will remain silent until the file finishes elaborating.

    Currently, it accounts for constants, syntax, shake records, and runtime IR (except for attributes like @[inline]), but not yet meta IR from new meta defs.

    To eliminate redundancies among the current file's imports without taking into account whether they are actually used or not, see #norm_imports.

    This command currently only suggests module-system import blocks. It may still help with modulizing non-module files if all necessary imports are already modules, or by indicating which necessary imports are non-modules.

    Equations
    Instances For

      Log a #min_imports message at the given tk, looking at the provided cmds syntax and all constants in the environment.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Bespoke infrastructure #

        Ideally, this should be replaced with more general backreporting infrastructure.

        @[inline]

        Logs at all requests in the minImportsRequests extension. Exposed for testing.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Erases all #min_imports requests up until this point. Exposed for testing so that the extension may remain private API.

          Equations
          Instances For