reflect

Runtime type inspection for structs, classes, and arbitrary values.

Import

import reflect

Functions

reflect.type_of(val: any) -> str

Return the type name of a value as a string.

reflect.fields(val: any) -> [str]

Return the field names of a struct or class instance.

reflect.methods(val: any) -> [str]

Return the method names of a struct or class instance.

reflect.is_instance(val: any, type: any) -> bool

Check if a value is an instance of a given type.

Examples

scratch.xs