Background:
Wave currently requires developers to explicitly repeat complex type definitions in full.
This makes code harder to maintain and reduces readability, especially when using deeply nested pointer types, tuples, or array types.
A type alias feature would allow defining shorthand names for types, improving clarity and reusability without affecting runtime behavior.
Expected Behavior:
Introduce a new declaration syntax for type aliases:
type MyInt = i32;
type Point = tuple<i32, i32>;
type Ptr10 = ptr<ptr<ptr<ptr<ptr<ptr<ptr<ptr<ptr<ptr<i32>>>>>>>>>>;
-
Aliases are fully expanded at compile time with no runtime overhead.
-
Type-checking uses the resolved underlying type — aliases are not treated as distinct types.
-
Nested and chained aliases are allowed:
type A = B;
type B = i64;
- Recursive aliases are disallowed:
type A = ptr<A>; // ❌ invalid
User Scenarios:
- A developer creates a reusable alias for a 10-layer pointer type:
type Ptr10 = ptr<...>;
- A team defines a standard alias
type FileId = i32; for shared meaning across files.
- Code becomes easier to maintain by using
type Vector3 = tuple<f32, f32, f32>; rather than rewriting it.
Additional Information:
-
Language version: - (not yet assigned)
-
Target branch: develop
-
Parser: Add support for parsing type IDENT = TYPE; syntax
-
AST: Introduce TypeAliasNode or equivalent
-
IR Generator: Substitute type alias with the underlying resolved type during code generation
-
Validation: Must prevent infinite recursive aliasing
Background:
Wave currently requires developers to explicitly repeat complex type definitions in full.
This makes code harder to maintain and reduces readability, especially when using deeply nested pointer types, tuples, or array types.
A type alias feature would allow defining shorthand names for types, improving clarity and reusability without affecting runtime behavior.
Expected Behavior:
Introduce a new declaration syntax for type aliases:
Aliases are fully expanded at compile time with no runtime overhead.
Type-checking uses the resolved underlying type — aliases are not treated as distinct types.
Nested and chained aliases are allowed:
User Scenarios:
type Ptr10 = ptr<...>;type FileId = i32;for shared meaning across files.type Vector3 = tuple<f32, f32, f32>;rather than rewriting it.Additional Information:
Language version: - (not yet assigned)
Target branch:
developParser: Add support for parsing
type IDENT = TYPE;syntaxAST: Introduce
TypeAliasNodeor equivalentIR Generator: Substitute type alias with the underlying resolved type during code generation
Validation: Must prevent infinite recursive aliasing