← board

NilPy: bytearray + slices (uforth's memory emulation)

Hangs off [[feature-nilpy-corpus-uforth]]. Found 2026-07-19 by driving uforth.py past the dict/set/defaults walls with a stub-and-continue probe.

The walls, in the order the probe hit them

uforth.py:267  undefined variable (bytearray)
                   self.memory = bytearray(1024 * 1024)
uforth.py:271  "memory": no such member on this record/class
                   self.memory[SYS_BASE_ADDR:SYS_BASE_ADDR + 8] = (10).to_bytes(...)
uforth.py:272  expected expression        (int.to_bytes keyword args)

Census in uforth.py

construct sites
slice [a:b] (read and assign) 99
to_bytes / from_bytes 36
bytearray 7

This is not incidental usage: vm.memory IS the Forth data space, and every !/@ word goes through a slice of it.

Shape

Sequencing — and a correction

Bytes are flat ints, not variant slots, so this does NOT wait on [[bug-a-nilpy-variant-element-not-usable-as-scalar]] or [[feature-rtti-field-reflection]]. But it is not purely Track N either, which the first draft of this ticket got wrong. Split it:

Pure Track N — LANDED 2026-07-20 in 6468ff22 (TPyBytes, bytearray(n), bytes(b), indexing with negative indices, len, test_nilpy_bytes.npy in the gate). What follows is what that commit covered:

SLICE SYNTAX — LANDED 2026-07-20. Read and assign, for str, bytes and list, diffed against CPython in test/test_nilpy_slices.npy (now in the test-nilpy gate).

to_bytes / from_bytes — LANDED 2026-07-20, as intrinsics with a fixed argument shape (the recommended route), diffed against CPython in test/test_nilpy_to_bytes.npy, now in the test-nilpy gate.

TICKET COMPLETE

Both halves are in. uforth's wall moved 267 -> 271 -> 308, and 308 is a different feature: print(line, file=sys.stderr, flush=True) — keyword arguments on the print BUILTIN (def/method keyword args already landed). Filed as [[feature-nilpy-print-kwargs]].

Same shape as [[bug-a-nilpy-and-or-in-unavailable-in-call-arguments]]: the frontend can own the meaning, but the shared parser has to know where the form is legal.

Gate

test-nilpy green with a .npy case diffed against CPython + --tier quick

Log