Reflection functions
Inspect declarations, types, and signatures at evaluation time.
| Function | Description |
|---|---|
| ast_string(target: &T) → utf8 | Pretty-print the canonical source behind a reference (type/interface/union/symbol_set/block/field) or a function value. |
| [builtin_names() → [utf8]](functionfnbuiltin_names) | The names of every registered built-in function, sorted. Pair with fn_signature to introspect each one. |
| [child_types(target: &T) → [&T]](functionfnchild_types) | Reflect a type into references to the element types of its @child / @children block slots (own slots first, then inherited via extends). Pair with type_table / type_fields to auto-document the blocks a @document declares. |
| decl_info(target: &T) → record | Describe a top-level declaration: its name, kind, doc comment, and schema classification (block / table / decorator / document). |
| decorator_arg(target: &T, decorator: utf8, slot: utf8) → any | Read one named argument of a decorator on a referenced declaration (none if absent). |
| [decorator_names(target: &T) → [utf8]](functionfndecorator_names) | List the names of the decorators attached to a referenced declaration. |
| doc_comment(target: &T) → utf8 | The doc comment — the contiguous run of # / // lines immediately above a declaration — attached to a reference, or \"\" when there is none. Complements decorator_arg(x, \"doc\", …) for @doc(\"…\") metadata. |
| eval(src: utf8) → any | Parse a string as a WCL expression and evaluate it in the current scope. |
| fn_signature(f: any) → record | Describe a function's parameters and return type. Pass a function value, or a built-in's name as a string. |
| [namespace_decls(ns: utf8) → [&T]](functionfnnamespace_decls) | List references to every top-level declaration (type / interface / union / symbol_set) in a namespace, for schema-documentation generators. Pair with decl_info, doc_comment, type_fields, and ast_string to render each. Imported (library) declarations are included — filter on decl_info(d).is_imported to drop them. |
| [type_fields(target: &T) → [record]](functionfntype_fields) | Reflect a type or interface into a list of field-description records (own fields first, then inherited via extends). |