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:
+31
-2
@@ -2,7 +2,8 @@ let usage =
|
||||
{|coollang toolchain
|
||||
|
||||
사용법:
|
||||
cool check <file.cool>... 타입/effect/capability 검사 (fast path)
|
||||
cool check <file.cool>... 타입/effect/capability 검사 (import를 따라 모듈 그래프 전체)
|
||||
cool iface <file.cool> interface 표면과 해시 출력
|
||||
cool run <file.cool> typed IR 인터프리터로 실행
|
||||
cool tokens <file.cool> 토큰 덤프 (렉서 디버깅)
|
||||
cool ast <file.cool> 구문 트리 덤프 (파서 디버깅)
|
||||
@@ -32,6 +33,33 @@ let dump_ast file =
|
||||
m.Coollang.Ast.items;
|
||||
0
|
||||
|
||||
(* import를 따라 모듈 그래프를 로드하고 전부 검사한다. root는 첫 파일의 디렉터리다. *)
|
||||
let check_graph files =
|
||||
match files with
|
||||
| [] ->
|
||||
prerr_endline "검사할 파일이 없습니다";
|
||||
2
|
||||
| first :: _ ->
|
||||
let st = Coollang.Session.create ~root:(Filename.dirname first) () in
|
||||
List.iter (fun f -> Coollang.Session.load st f) files;
|
||||
let errors = Coollang.Session.errors st in
|
||||
List.iter
|
||||
(fun e -> prerr_endline (Coollang.Session.string_of_error e))
|
||||
errors;
|
||||
if errors = [] then 0 else 1
|
||||
|
||||
let dump_iface file =
|
||||
let st = Coollang.Session.create ~root:(Filename.dirname file) () in
|
||||
Coollang.Session.load st file;
|
||||
match Coollang.Session.find st file with
|
||||
| None -> 1
|
||||
| Some e ->
|
||||
Printf.printf "hash %s\n" e.iface.Coollang.Iface.hash;
|
||||
List.iter
|
||||
(fun it -> print_endline (Coollang.Ast.show_item it))
|
||||
e.iface.Coollang.Iface.items;
|
||||
0
|
||||
|
||||
let dump_deps file =
|
||||
match Coollang.Driver.resolve file with
|
||||
| Error errors -> report_errors errors
|
||||
@@ -46,7 +74,8 @@ let () =
|
||||
let argv = Array.to_list Sys.argv in
|
||||
let code =
|
||||
match List.tl argv with
|
||||
| "check" :: files -> report (Coollang.Driver.check files)
|
||||
| "check" :: files -> check_graph files
|
||||
| [ "iface"; file ] -> dump_iface file
|
||||
| [ "run"; file ] -> report (Coollang.Driver.run file)
|
||||
| [ "tokens"; file ] -> dump_tokens file
|
||||
| [ "ast"; file ] -> dump_ast file
|
||||
|
||||
Reference in New Issue
Block a user