Skip to main content

Mojo module

type_info

Provides type and function name introspection utilities.

This module provides compile-time introspection of type and function names:

  • get_type_name[T]() - returns the name of a type
  • get_function_name[func]() - returns the source name of a function
  • get_linkage_name[func]() - returns the symbol/linkage name of a function

Example:

from reflection import get_type_name, get_function_name

struct Point:
    var x: Int
    var y: Float64

fn my_function():
    pass

fn main():
    print(get_type_name[Point]())        # "Point"
    print(get_function_name[my_function]())  # "my_function"

Functions​

Was this page helpful?