diff options
| author | eunhhu <[email protected]> | 2026-09-26 11:49:33 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-26 11:49:33 +0100 |
| commit | cb0f7878f11025ea31cd4c5cecb5ae359b14c148 (patch) | |
| tree | 2c2e55d415a5fe264f5a431edfcc45d14f059122 /docs/design | |
| parent | 7b0d1ec72ee45631d7e71d7498d360b49e268eb6 (diff) | |
| download | aup-cb0f7878f11025ea31cd4c5cecb5ae359b14c148.tar.gz aup-cb0f7878f11025ea31cd4c5cecb5ae359b14c148.zip | |
Add aup watch: build again when what a build read changes
A build records every path it opened or looked for and a digest of the
bytes there, so a rebuild happens exactly when one of them reads
differently: the source, a library (the one with the error too), or a
library appearing where one was searched. A change is built once it reads
the same twice in a row, so a file caught halfway through being written
is never built; the module is replaced whole through a rename.
Diffstat (limited to 'docs/design')
| -rw-r--r-- | docs/design/002-dsl-direction.md | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/docs/design/002-dsl-direction.md b/docs/design/002-dsl-direction.md index 2ba217a..1432ef6 100644 --- a/docs/design/002-dsl-direction.md +++ b/docs/design/002-dsl-direction.md @@ -208,4 +208,26 @@ view summary = words.counted(tasks.count, "task", "tasks") 검증: 라이브러리를 쓴 할 일 목록이 참조 모델과 일치하고, 인자를 한 번만 계산하며(값 전달), 라이브러리 경로·순환· 상태 선언·앱 상태 읽기 오류가 해당 파일 위치로 보고된다. 같은 소스와 라이브러리는 같은 모듈을 만든다. 진단 10건을 더했다. +### 다시 빌드: aup watch + +```sh +aup watch app.aup -o app.pmod # 저장할 때마다 다시 빌드 +vega tui app.pmod --watch # 실행 중인 앱이 새 모듈로 바뀐다(상태는 이름으로 이어진다) +``` + +- **빌드는 읽은 바이트의 함수다.** 빌드는 연 경로와 찾아봤지만 없던 경로를 모두 기록하고, 거기서 읽은 바이트의 + digest를 함께 남긴다(소스, 쓴 라이브러리, 앞선 탐색 위치). 다시 빌드할 이유는 이 경로 중 하나가 다르게 + 읽히는 것뿐이다. 파일 시각을 보지 않으므로 빌드와 기록 사이의 저장을 놓치지 않는다. 같은 바이트를 다시 저장하면 + 아무 일도 없다. 오류가 난 라이브러리를 고치면 다시 빌드되고, 앞선 탐색 위치에 라이브러리가 새로 생겨도 다시 + 빌드된다. +- **쓰는 중인 파일은 빌드하지 않는다.** 바뀐 내용은 50 ms 간격으로 두 번 연속 같게 읽힐 때 빌드한다. 편집기가 + 제자리에 쓰는 도중의 빈 파일이나 앞부분도 컴파일될 수 있는데, 그런 모듈로 바꾸면 실행 중인 앱은 사라진 상태의 + 값을 잃는다. +- **모듈은 통째로만 바뀐다.** 결과를 임시 파일에 쓰고 rename한다(`aup build`도 같다). 오류가 나면 마지막 모듈을 + 그대로 두고, 결과마다 stderr에 한 줄(`aup: built app.pmod` 또는 진단)을 쓴다. + +검증: 소스 수정, 라이브러리 수정, 라이브러리의 오류와 수정, 앞선 위치에 라이브러리가 생김, 같은 바이트 저장, 두 +번에 나눠 쓴 저장 10회(앞부분만으로도 컴파일되는 소스)에서 빌드된 모듈이 매번 기대한 보기를 낸다. 두 번 읽기를 +빼면 나눠 쓴 저장 검사가 8번 중 8번 실패한다. + 구현은 C로 손수 쓴 재귀 하강 파서를 유지한다. 문법은 EBNF로 문서화하고, 이후 `aup fmt`와 언어 서버를 붙인다. |
