Literal Pattern
语法
literal pattern 当前至少包括:
- int
- bool
语义
它要求被匹配值与给定字面量相等。
Usage
match n {
0 => zero()
1 => one()
_ => many()
}
注释:这里的 0、1 都是 literal pattern,用于表达精确值匹配,而不是引入绑定。
边界
需要单独明确:
- 字符串字面量是否进入 pattern
- 数值比较是否要求同型
这里集中展示 CHIBA level-1 specification,覆盖 core language、control flow、memory、patterns、IR lowering 与 package system 等实现边界。
The docs surface keeps CHIBA level-1 specification pages browsable inside the site, with direct paths into language, control flow, memory, pattern, and lowering rules.
literal pattern 当前至少包括:
它要求被匹配值与给定字面量相等。
match n {
0 => zero()
1 => one()
_ => many()
}
注释:这里的 0、1 都是 literal pattern,用于表达精确值匹配,而不是引入绑定。
需要单独明确: