aboutsummaryrefslogtreecommitdiffstats
path: root/docs/design/002-dsl-direction.md
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-19 03:56:43 +0100
committereunhhu <[email protected]>2026-10-19 03:56:43 +0100
commit4aefbab3cdbcb5a7c4b7598795baa276f82fd842 (patch)
treef95850f5b392f6a24491004216564b796f0415ef /docs/design/002-dsl-direction.md
parent0d66663351c411693c71788804717ad2694c81cd (diff)
downloadaup-4aefbab3cdbcb5a7c4b7598795baa276f82fd842.tar.gz
aup-4aefbab3cdbcb5a7c4b7598795baa276f82fd842.zip
Bytes compared (Pure's TEXT_COMPARE with PURE_COMPARE_BYTES): ==, !=, <, <=, >, >= between bytes by their bytes; a string (a literal, or one with formats) where bytes are what it meets, compared or joined, is its UTF-8 bytes, as 1 is an i64 where i64s go, values of text and bytes mixing in neither (bytes(t) or text(b)); test bytes_compared (400 random pairs with 0x00 and 0xff in the six relations, literals on either side, a formatted string, joins with literals, against Python), two diagnostics; the 60 sources compiled before the same modules; 002
Diffstat (limited to 'docs/design/002-dsl-direction.md')
-rw-r--r--docs/design/002-dsl-direction.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/design/002-dsl-direction.md b/docs/design/002-dsl-direction.md
index 31d4212..3ba3d5d 100644
--- a/docs/design/002-dsl-direction.md
+++ b/docs/design/002-dsl-direction.md
@@ -917,3 +917,19 @@ on give {
- 검증: `bare_lists`가 무작위 리스트 200개를 행으로 받아 리스트를 받는 fn, 두 리스트를 돌려주는 fn, 수의 리스트를 돌려주는 fn을
지나게 하고 파이썬과 견준다. 진단 둘(리스트 값을 바꾸기, 저장되는 리스트를 넘기기). 그 전에 컴파일되던 aup 소스 60개의 모듈은
바이트까지 같다.
+
+### 바이트의 비교 (Pure 140의 DNS와 HTTP 뒤)
+
+```text
+on packet {
+ if f.name == "content-length" { ... } # 바이트를 만나는 문자열은 그 UTF-8 바이트다
+ require s.name < t.name # 바이트는 바이트끼리 바이트 순서로 (Pure의 TEXT_COMPARE, PURE_COMPARE_BYTES)
+ let line = s.name + ": " + s.value + "\r\n" # 잇기도 같다
+}
+```
+
+- **비교.** `==`, `!=`, `<`, `<=`, `>`, `>=`가 바이트 둘을 바이트 순서로 견준다(앞이 같으면 짧은 쪽이 앞). UTF-8을 묻지 않는다.
+- **리터럴은 만나는 것을 따른다.** 문자열(리터럴과 형식이 든 것)이 바이트를 만나면 그 UTF-8 바이트가 된다. i64를 만나는 `1`이
+ i64인 것과 같다. 값끼리는 섞이지 않는다: text의 값과 바이트의 값은 비교도 잇기도 하지 않고(진단), `bytes(t)`나 `text(b)`로 옮긴다.
+- 검증: `bytes_compared`가 0x00과 0xff가 든 무작위 바이트 400쌍을 여섯 관계, 양쪽의 리터럴, 형식이 든 문자열, 리터럴과의 잇기로
+ 파이썬과 견준다. 진단 둘(바이트와 text의 값). 그 전에 컴파일되던 소스 60개의 모듈은 바이트까지 같다.