Chiba Logo CHIBA v0.6.13
CHIBA blog RSS feed
CHIBA / DOCS / LEVEL-1 SPEC

Literal 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

语法

literal pattern 当前至少包括:

  • int
  • bool

语义

它要求被匹配值与给定字面量相等。

Usage

match n {
	0 => zero()
	1 => one()
	_ => many()
}

注释:这里的 01 都是 literal pattern,用于表达精确值匹配,而不是引入绑定。

边界

需要单独明确:

  • 字符串字面量是否进入 pattern
  • 数值比较是否要求同型