Skip to content

Settle the Unicode/text position: bytes-forever + lib/utf8.eigs (#416)#436

Merged
InauguralPhysicist merged 1 commit into
mainfrom
feat/unicode-utf8-416
Jul 5, 2026
Merged

Settle the Unicode/text position: bytes-forever + lib/utf8.eigs (#416)#436
InauguralPhysicist merged 1 commit into
mainfrom
feat/unicode-utf8-416

Conversation

@InauguralPhysicist

Copy link
Copy Markdown
Collaborator

What

Retrofitting text semantics post-1.0 is the most expensive migration in language history — so this settles it deliberately, pre-1.0.

str is a byte string by definition — now official in SPEC.md's new "Text" subsection: len/char_at/[]/slicing index bytes, and UTF-8 source literals round-trip exactly through concat/f-strings/printing (byte-checked examples). Native UTF-8-by-construction is deliberately not adopted: it would ripple through the VM, JIT, AOT, and every tool for a bill this scale doesn't need.

Character semantics come from the new lib/utf8.eigsutf8_len / utf8_codepoints / utf8_at / utf8_char_at / utf8_validate, decoding UTF-8 over the byte primitives. Tested against published vectors (U+00E9 2-byte, U+20AC 3-byte, U+10348 4-byte) and validation cases built by slicing real multibyte chars into truncated/lone-continuation sequences. Suite [50k], 16 checks.

Forcing function surfaced a real gap (#435)

Building the module hit a wall: chr returns "" for code > 127, so there is no way to construct a byte ≥ 0x80 in EigenScript. utf8_encode (and byte-output generally) is impossible until that's fixed. Filed as #435 (make chr emit 0–255, symmetric with ord) rather than worked around; encode is omitted with a pointer, decode is the load-bearing half.

Gates: suite 2512/2512; ASan clean; SPEC + STDLIB doc-drift green.

Closes #416

🤖 Generated with Claude Code

…gs (#416)

Retrofitting text semantics post-1.0 is the most expensive migration in language
history, so this settles it deliberately. `str` is a byte string BY DEFINITION —
now official in SPEC.md's new "Text" subsection (byte indexing, multibyte-safe
concat/f-strings, byte-checked examples). Native UTF-8-by-construction is
deliberately NOT adopted: it would ripple through the VM, JIT, AOT, and every
tool for a bill this scale doesn't need.

Character semantics, when you need them, come from the new lib/utf8.eigs —
utf8_len / utf8_codepoints / utf8_at / utf8_char_at / utf8_validate, decoding
UTF-8 over the byte primitives (char_at/ord). Tested against published vectors
(U+00E9 2-byte, U+20AC 3-byte, U+10348 4-byte) and structural-validation cases
built by slicing real multibyte chars; suite [50k].

Building it surfaced a real language gap, filed rather than worked around:
`chr` returns "" for code > 127, so there is no way to construct a byte >= 0x80
in EigenScript — `utf8_encode` (and byte-output generally) is impossible until
that lands. Filed #435; encode is omitted with a pointer, decode is the
load-bearing half at this scale.

Suite 2512/2512; ASan clean.

Closes #416

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@InauguralPhysicist InauguralPhysicist merged commit 621df25 into main Jul 5, 2026
17 checks passed
@InauguralPhysicist InauguralPhysicist deleted the feat/unicode-utf8-416 branch July 5, 2026 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Design: Unicode/text position — pick and document a deliberate stance pre-1.0

1 participant