Documentation

Lean.Compiler.InitAttr

@[extern lean_run_init]
unsafe opaque Lean.runInit (env : Environment) (opts : Options) (decl initDecl : Name) :

Run the initializer for decl and store its value for global access. Should only be used while importing.

Set of modules for which we have already run the module initializer in the interpreter.

unsafe def Lean.registerInitAttrUnsafe (attrName : Name) (runAfterImport : Bool) (ref : Name) :
Instances For
    @[inline]
    def Lean.registerInitAttr (attrName : Name) (runAfterImport : Bool) (ref : Name := by exact decl_name%) :
    Instances For

      Registers an initialization procedure. Initialization procedures are run in files that import the file they are defined in.

      This attribute comes in two kinds: Without arguments, the tagged declaration should have type IO Unit and are simply run during initialization. With a declaration name as a argument, the tagged declaration should be an opaque constant and the provided declaration name an action in IO that returns a value of the type of the tagged declaration. Such initialization procedures store the resulting value and make it accessible through the tagged declaration.

      The initialize command should usually be preferred over using this attribute directly.

      Registers a builtin initialization procedure.

      This attribute is used internally to define builtin initialization procedures for bootstrapping and should not be used otherwise.

      @[export lean_get_regular_init_fn_name_for]
      Instances For
        @[export lean_get_init_fn_name_for]
        Instances For
          Instances For
            Instances For
              Instances For
                Instances For
                  Instances For
                    def Lean.declareBuiltin (forDecl : Name) (value : Expr) :
                    Instances For