Phase 7f: len(x) works on strings too (retire slen)
`len` is now polymorphic — a slice's element count OR a string's byte length — so the C-style `slen` (strlen) is gone: `slen(name)` -> `len(name)`. emit_len branches on the operand type (slice header vs @strlen). Two reseeds: add the string branch, then migrate the 19 slen calls and delete slen. Reseeded (22565 lines); C-free fixpoint holds; goldens identical; 18/18; vocab + doc-fences clean. (String slicing s[a..b] to replace substr is deferred to its own phase.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
058cac88ec
commit
839a6bf0c0
11 changed files with 3555 additions and 3542 deletions
|
|
@ -628,8 +628,9 @@ literal; test any pointer/record/slice with `x == null` / `x != null` (an unset
|
|||
# save save() load()->bool (binary snapshot of the whole ECS World)
|
||||
# control quit() print(x) (a value + newline)
|
||||
# convert str(x) -> str (int/bool/fixed -> text)
|
||||
# length len(x) -> int (elements of a slice, or bytes of a string)
|
||||
# process os_argc()->int os_arg(i)->str (the command line; argv[0] included)
|
||||
# file_stderr()->ptr (a handle for file_write, off stdout)
|
||||
# file_stderr()->ptr file_stdout()->ptr (handles for file_write)
|
||||
```
|
||||
|
||||
## Tooling
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue