Skip to content

Commit 76ddf16

Browse files
committed
Refresh generic constraint spec status
1 parent 0189ee0 commit 76ddf16

2 files changed

Lines changed: 15 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7474
- Corrected memory-safety documentation so the spec no longer claims unimplemented lifetime, double-free, use-after-free, or bounds-check guarantees.
7575
- Marked the tensor/AI/GPU section as planned design work instead of current language support.
7676
- De-scoped `std/string`, `std/mem`, and `std/collections` from current stdlib documentation; only virtual `io` and `math` modules are documented as implemented.
77+
- Updated generic constraint spec notes to describe the implemented `$T: Constraint` syntax instead of stale planned-only wording.
7778

7879
- **Import handling**
7980
- Local file-based imports now load dependencies during semantic analysis and fail closed on missing or broken modules.

docs/SPEC.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
6. [Functions](#functions)
2323
7. [Generics](#generics)
2424
8. [Memory Management](#memory-management)
25-
9. [Array Programming for AI](#array-programming-for-ai)
25+
9. [Planned Array Programming for AI](#planned-array-programming-for-ai)
2626
10. [Modules and Visibility](#modules-and-visibility)
2727
11. [Built-in Functions and Operators](#built-in-functions-and-operators)
2828
12. [Tokens and AST Components](#tokens-and-ast-components)
@@ -39,8 +39,7 @@ It features:
3939
- **Static typing** with type inference
4040
- **Compile-time generics** via monomorphization
4141
- **Manual memory management** with safety features
42-
- **Planned array programming for AI** with broadcasting and vectorized operations
43-
- **Multidimensional tensors** with efficient memory layouts
42+
- **Planned array programming for AI** with broadcasting, vectorized operations, and multidimensional tensors
4443
- **File-based module system** with controlled visibility
4544
- **Zero-cost abstractions**
4645
- **Platform-aware integer types** (isize/usize)
@@ -858,9 +857,9 @@ Result :: union {
858857

859858
### 7.3 Type Sets and Constraints
860859

861-
> **Implementation Status**: Type-set syntax is partially implemented. Current known gaps are:
862-
> top-level `@type_set(...)` expression parsing in declarations, and constraint-aware
863-
> checking for generic arithmetic.
860+
> **Implementation Status**: Type-set syntax is implemented for predefined sets,
861+
> local `@type_set(...)` aliases, and inline constraints on declared generic
862+
> functions. Inferred call arguments are checked against declared type sets.
864863
865864
Type sets are defined using the `@type_set()` builtin function:
866865

@@ -877,15 +876,13 @@ SmallInts :: @type_set(i8, u8, i16, u16)
877876
BigInts :: @type_set(i64, u64)
878877
```
879878

880-
**Future Constraint Syntax** (planned for semantic analysis phase):
879+
**Current Constraint Syntax**:
881880
```a7
882-
// Constraint syntax will allow restricting generic types
883-
// Note: This is planned syntax, not yet enforced
884-
abs :: fn(x: $T) $T { // where $T: Numeric
881+
abs($T: Numeric) :: fn(x: $T) $T {
885882
ret if x < 0 { -x } else { x }
886883
}
887884
888-
min :: fn(a: $T, b: $T) $T { // where $T: Numeric
885+
min($T: Numeric) :: fn(a: $T, b: $T) $T {
889886
ret if a < b { a } else { b }
890887
}
891888
```
@@ -2044,9 +2041,9 @@ p := Pair(i32, string){42, "answer"}
20442041

20452042
### 7.3 Type Sets and Constraints
20462043

2047-
> **Implementation Status**: Type-set syntax is partially implemented. Current known gaps are:
2048-
> top-level `@type_set(...)` expression parsing in declarations, and constraint-aware
2049-
> checking for generic arithmetic.
2044+
> **Implementation Status**: Type-set syntax is implemented for predefined sets,
2045+
> local `@type_set(...)` aliases, and inline constraints on declared generic
2046+
> functions. Inferred call arguments are checked against declared type sets.
20502047
20512048
Type sets are defined using the `@type_set()` builtin function:
20522049

@@ -2063,15 +2060,13 @@ SmallInts :: @type_set(i8, u8, i16, u16)
20632060
BigInts :: @type_set(i64, u64)
20642061
```
20652062

2066-
**Future Constraint Syntax** (planned for semantic analysis phase):
2063+
**Current Constraint Syntax**:
20672064
```a7
2068-
// Constraint syntax will allow restricting generic types
2069-
// Note: This is planned syntax, not yet enforced
2070-
abs :: fn(x: $T) $T { // where $T: Numeric
2065+
abs($T: Numeric) :: fn(x: $T) $T {
20712066
ret if x < 0 { -x } else { x }
20722067
}
20732068
2074-
min :: fn(a: $T, b: $T) $T { // where $T: Numeric
2069+
min($T: Numeric) :: fn(a: $T, b: $T) $T {
20752070
ret if a < b { a } else { b }
20762071
}
20772072
```

0 commit comments

Comments
 (0)