aboutsummaryrefslogtreecommitdiffstats
path: root/docs/design/001-language-v0.md
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-27 07:30:51 +0100
committereunhhu <[email protected]>2026-09-27 07:30:51 +0100
commit1a72fe031a007323c51f49810dcf6164b8aaaae2 (patch)
treeb170926648e20c8570c137231096313ac4e4fe4a /docs/design/001-language-v0.md
parent49324b0a75549960af0a13b1d884eaac637312ef (diff)
downloadaup-1a72fe031a007323c51f49810dcf6164b8aaaae2.tar.gz
aup-1a72fe031a007323c51f49810dcf6164b8aaaae2.zip
Group message fields: to: { city: text }, read as ship.to.city
A message's field block may hold groups, nested as deep as the 31 characters of a path allow; the compiler flattens them into fields named by their path (to.city), which Pure's module format takes, so groups cost nothing at run time. A member chain on a message names a field by its path; one that stops at a group, or names a field the group lacks, is diagnosed, and a field's own member (m.text.bytes) still reads the field. A module may have 64 message fields. The JSON server check posts 100 random bodies with groups two deep (members shuffled at every level, strings with escapes, control bytes, Korean, emoji and U+2028) to pure-serve, which reads them in place, and compares the answers and the table with a Python model; a group's fixed field from the query and ten malformed group bodies are checked too. Six diagnostics cover groups.
Diffstat (limited to 'docs/design/001-language-v0.md')
-rw-r--r--docs/design/001-language-v0.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/design/001-language-v0.md b/docs/design/001-language-v0.md
index 660abae..7a5b0d6 100644
--- a/docs/design/001-language-v0.md
+++ b/docs/design/001-language-v0.md
@@ -115,6 +115,10 @@ on edit {
- 필드 타입은 `u32`, `number`(유한한 수), `bytes`, `text`(UTF-8)이고 가변 필드(bytes, text)는 몇 개든 어디에나 둘 수 있다.
`input add = message { title: text, points: number }`. HTTP 호스트(`pure-serve`)는 JSON 본문의 객체를 이 필드들로
옮긴다. 도착한 메시지의 text가 UTF-8이 아니거나 수가 유한하지 않으면 그 이벤트는 실패한다.
+- 필드를 그룹으로 묶을 수 있다: `to: { city: text, zip: u32 }`. 그룹 안의 필드는 `메시지.그룹.필드`(`ship.to.city`)로
+ 읽고, JSON 본문에서는 안의 객체(`{"to": {"city": "Seoul", "zip": 4}}`), 쿼리에서는 경로(`?to.zip=4`)다. 그룹은 겹칠 수
+ 있고, 경로는 31자 이하, 한 메시지의 필드는 그룹 안까지 합쳐 64개 이하다. 모듈에서는 `to.city` 같은 이름의 필드로 펼쳐지므로
+ 실행 비용이 없다.
- `이름[key]`는 그 메시지 키의 문서다. 읽으면 bytes, `.bytes`는 크기(없으면 0)다. 없는 문서를 읽으면 `not_found`.
- `replace(a .. b, 값)`는 문서의 `[a, b)`를 바꾼다. 정수가 아니거나 범위 밖이면 이벤트가 `limit`으로 실패한다.
- `require 조건`이 거짓이면 이벤트가 `limit`으로 실패한다. 크기 정책처럼 저장소의 특수 인자였던 것이 문장 하나가 된다.