Context
Identified during spec-test alignment audit (GAP-16). The language specification documents struct parameter modifiers but they are not implemented in the compiler.
Current behavior
Struct parameter modifiers (in[], mut[], out[]) are documented in the specification but are not recognized by the lexer, parser, or semantic analysis. Using them results in a syntax error.
Expected/proposed
Implement the struct parameter modifier syntax as specified:
in[T] — immutable borrow (pass by readonly reference)
mut[T] — mutable borrow (pass by reference)
out[T] — output parameter
These modifiers provide explicit control over struct passing semantics, aligning with the .NET value type model while maintaining Python-like syntax.
Implementation would require changes to:
- Lexer — recognize
in, mut, out as contextual keywords in parameter positions
- Parser — parse modifier syntax in parameter declarations
- Semantic — validate modifier usage (e.g.,
mut only on struct types)
- CodeGen — emit appropriate
ref/in/out parameter modifiers in C#
References
docs/language_specification/structs.md — struct parameter modifier specification
docs/language_specification/type_system.md — value type semantics
Context
Identified during spec-test alignment audit (GAP-16). The language specification documents struct parameter modifiers but they are not implemented in the compiler.
Current behavior
Struct parameter modifiers (
in[],mut[],out[]) are documented in the specification but are not recognized by the lexer, parser, or semantic analysis. Using them results in a syntax error.Expected/proposed
Implement the struct parameter modifier syntax as specified:
in[T]— immutable borrow (pass by readonly reference)mut[T]— mutable borrow (pass by reference)out[T]— output parameterThese modifiers provide explicit control over struct passing semantics, aligning with the .NET value type model while maintaining Python-like syntax.
Implementation would require changes to:
in,mut,outas contextual keywords in parameter positionsmutonly on struct types)ref/in/outparameter modifiers in C#References
docs/language_specification/structs.md— struct parameter modifier specificationdocs/language_specification/type_system.md— value type semantics