1.1. Boost macro layer — DSL for declarative widget composition

The boost DSL spine — [widget] and [container] function annotations. Mark def myWidget(var state : ST, …) with [widget] and the macro injects a widget_ident parameter, idempotently emits IDENT as a module-scope state global at the first call site, parses the dotted-suffix flag chain (SAVE_BTN.PUBLIC, RPS.NOTLIVE), and rewrites the call to myWidget(IDENT, "IDENT", …). [container] is the block-arg sibling: same identifier auto-emit, plus container_path_push(widget_ident) / container_path_pop() around invoke(blk) so leaf telemetry paths nest into MAIN_WIN/SETTINGS_TAB/RPS. UPPER_SNAKE_CASE identifiers by convention (API_REWORK §4.5); auto-emit is module-scope only.

Begin/End pairing — which call paints always vs only-on-true — is NOT abstracted; each container def authors its own Begin invoke(blk) End sequence so the imgui-irregular rules stay visible at the call site.

1.1.1. Function annotations

widget

[widget] annotation — registers def fn(var state : ST, ...) as a stateful widget. Auto-emits the state global, injects widget_ident, and installs a per-kind call_macro for dotted-flag parsing.

container

[container] annotation — block-arg sibling of [widget]; same identifier auto-emit, plus container_path_push/pop around invoke(blk) so leaf telemetry paths nest correctly.

edit_widget

[edit_widget] annotation — registers an external-pointer widget. First parameter is the user-owned pointer (T?); macro injects widget_ident : string at index 1 and installs a call_macro that requires an explicit id="..." literal at the call site.

1.1.2. Classes

WidgetFunctionMacro : AstFunctionAnnotation

class WidgetFunctionMacro

WidgetFunctionMacro.apply(func: FunctionPtr; group: ModuleGroup; args: AnnotationArgumentList; errors: das_string ): bool

def apply : function<(var self:ast::AstFunctionAnnotation;var func:ast_core::Function? aka FunctionPtr -const;var group:rtti_core::ModuleGroup -const;args:rtti_core::AnnotationArgumentList const;var errors:$::das_string -const):bool>

Arguments:
ContainerFunctionMacro : AstFunctionAnnotation

class ContainerFunctionMacro

ContainerFunctionMacro.apply(func: FunctionPtr; group: ModuleGroup; args: AnnotationArgumentList; errors: das_string ): bool

def apply : function<(var self:ast::AstFunctionAnnotation;var func:ast_core::Function? aka FunctionPtr -const;var group:rtti_core::ModuleGroup -const;args:rtti_core::AnnotationArgumentList const;var errors:$::das_string -const):bool>

Arguments:
WidgetCallMacro : AstCallMacro

class WidgetCallMacro

WidgetCallMacro.visit(prog: ProgramPtr; mod: Module?; expr: ExprCallMacro? ): ExpressionPtr

def visit : function<(var self:ast::AstCallMacro;prog:smart_ptr<rtti_core::Program> aka ProgramPtr const;mod:rtti_core::Module? const;expr:ast_core::ExprCallMacro? const):ast_core::Expression? aka ExpressionPtr>

Arguments:
WidgetCallMacro.canVisitArgument(expr: ExprCallMacro?; argIndex: int ): bool

def canVisitArgument : function<(var self:ast::AstCallMacro;expr:ast_core::ExprCallMacro? const;argIndex:int const):bool>

Arguments:
EditWidgetFunctionMacro : AstFunctionAnnotation

class EditWidgetFunctionMacro

EditWidgetFunctionMacro.apply(func: FunctionPtr; group: ModuleGroup; args: AnnotationArgumentList; errors: das_string ): bool

def apply : function<(var self:ast::AstFunctionAnnotation;var func:ast_core::Function? aka FunctionPtr -const;var group:rtti_core::ModuleGroup -const;args:rtti_core::AnnotationArgumentList const;var errors:$::das_string -const):bool>

Arguments:
EditExternalCallMacro : AstCallMacro

Call macro installed by [edit_widget]. Recognizes edit_kind(ptr, (id="...", ...)), requires an explicit id= string literal, destructures the rest of the named-tuple to positional args (source order — match parameter order, like WidgetCallMacro), and rewrites to a direct call into the renderer.

Fields:
  • kind_name : string - Name of the [edit_widget]-decorated function — used as the rewritten call’s target and in macro_error messages.

  • render_fn : FunctionPtr - Underlying [edit_widget] function pointer; lives in the user module and is read at visit time.

  • render_fn_args : array< VariablePtr> - User-facing args (positions 2..N after ptr + injected widget_ident); cloned from render_fn so the wrapper preserves names/defaults.

EditExternalCallMacro.visit(prog: ProgramPtr; mod: Module?; expr: ExprCallMacro? ): ExpressionPtr

def visit : function<(var self:ast::AstCallMacro;prog:smart_ptr<rtti_core::Program> aka ProgramPtr const;mod:rtti_core::Module? const;expr:ast_core::ExprCallMacro? const):ast_core::Expression? aka ExpressionPtr>

Arguments: