modules: 모듈 경계, interface hash, 그리고 고정점 invalidation

되돌리기 비싼 결정 중 마지막 하나 — incremental 아키텍처 — 를 코드와
테스트로 닫는다.

- iface.ml: exported surface 추출과 해시. 별칭 한정(qualify)은 소비 시점에만
  일어나므로 가져오는 쪽의 별칭이 정의 모듈의 hash에 새지 않는다.
- session.ml: 모듈 로딩과 고정점 전파. hash 비교가 dependents 재검사보다
  앞선다 — 이 순서가 "본문만 수정 시 downstream 0건"의 전부다.
- 한정 이름(Alias.Type, Alias.Ctor, Alias.fn)을 타입 검사, 패턴, 소진성,
  move 검사가 모두 하나의 키("Alias.name")로 본다.
- 패키지 경로(cool.dev/std/list)는 v0에서 해소하지 않고 불투명하게 둔다.
  없다고 말하지 않는다.
- 회귀 테스트: 본문만 고치면 자기 자신만 재검사(1건), variant를 추가하면
  downstream까지 전파되고 실제로 소진성이 깨진다(2건).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ZVDeU6KLuUVL3gs18Hm3E
This commit is contained in:
2026-08-30 14:11:30 +09:00
co-authored by Claude Opus 5
parent 5218bc59a7
commit 801a7b330b
12 changed files with 646 additions and 54 deletions
+13
View File
@@ -0,0 +1,13 @@
// 모듈 B. A의 표면에만 의존한다.
//
// Shape의 variant가 늘면 이 match가 깨진다 — 그래서 enum 정의 본문이
// interface hash 입력이고, A의 시그니처 변경은 여기까지 전파되어야 한다.
import "shapes" as Shapes
pub fn area(s: Shapes.Shape) -> Int {
match s {
Shapes.Circle(r) => Shapes.double(r),
Shapes.Square(w) => w * w,
}
}
+11
View File
@@ -0,0 +1,11 @@
// 모듈 A. downstream이 보는 것은 이 파일의 exported surface뿐이다.
pub enum Shape {
Circle(Int),
Square(Int),
}
pub fn double(n: Int) -> Int {
// 본문. 이 안을 아무리 고쳐도 interface hash는 변하지 않는다.
n + n
}