Expand description
Type definitions for the AIM expression grammar.
This module provides type definitions and parsing for the type system used in the AIM expression language. It includes basic types like Bool, Date, Number, Task, and Text, as well as array variants and special types like Closure, Eval, Format, and Node.
The Typedef enum represents the complete type system for AIM expressions,
supporting type checking, casting operations, and function signature validation.
Type definitions are used throughout the expression evaluation system to ensure
type safety and enable automatic type promotion.
§Supported Types
§Basic Types
Any- Any type (wildcard type that matches any value)Bool- Boolean values (true/false)Date- Date and time valuesNumber- 64-bit floating point numbersTask- Task primitives with status and textText- String values
§Array Types
Any[]- Array of any values (heterogeneous)Bool[]- Arrays of boolean valuesDate[]- Arrays of date valuesNumber[]- Arrays of number valuesTask[]- Arrays of task valuesText[]- Arrays of text values
§Special Types
Closure- Closure expression type (anonymous functions)Eval- Evaluation results (inference output)Format- Formatting instructions (output formatting)Node- Node references (workflow references)
§Type Promotion Rules
AIMX uses an intuitive type promotion strategy where the left operand’s type generally dictates the conversion for the right operand. This allows for expressive, convenient formulas while preserving type safety.
§Examples
// Type casting examples
(Bool)true // cast to boolean
(Number)"123" // cast to number
(Text[])items // cast to text array
// Function signature examples
task.done() // requires Typedef::Task
numbers.sum() // requires Typedef::NumberArray
text.upper() // requires Typedef::Text§Usage
Type definitions are primarily used for:
- Type casting operations in expressions
- Function signature validation
- Method dispatch based on receiver type
- Type checking during expression evaluation
See also: parse_typedef, parse_literal_type, Typedef
Enums§
- Typedef
- Represents type definitions in the AIM expression grammar.
Functions§
- parse_
literal_ type - Parse a literal type definition from a string.
- parse_
typedef - Parse a type definition from a string according to the AIM expression grammar syntax.