ReviewOS

home-lang/home-os

A8: Zig-era syntax migration — 34 .home imports converted, 4 broken paths found

#42
Open chris opened this 10 days ago ·
10 days ago

Milestone A8 in MASTER_PLAN §6 is the one-time migration of the tree to current Home idiom. This issue tracks the part of it that was actively breaking things, and what remains.

Done: const x = → import "path.home" as x

34 imports across 21 files. The Zig form binds a name without registering a module alias, so every call through it was unresolved by the backend.

security/ptr_safety.home went from 51 unlowered constructs to zero on this change alone — all 51 were calls through a serial binding the codegen could not see.

It also uncovered four broken import paths

The Zig form binds a name without resolving anything, so a wrong path costs nothing until something actually needs the module. Once these became real imports, the parser checked them:

FileImportedReality
arch/x86_64/syscall_fast.home../cpu.home, gdt.homeNeither exists anywhere in the tree — and nothing in the file used either. Dead imports, removed.
core/numa.home../arch/x86_64/acpi.homeACPI is at power/acpi.home. Repointed.
fs/exfat.homevfs.homeNo such file. Repointed at core/vfs_block_io.home.
fs/iso9660.homevfs.homeSame.

exfat and iso9660 call vfs.block_read / vfs.block_write, which exist nowhere in the tree — vfs_block_io.home provides bread/bwrite. Those calls are still unresolved and are the next thing for whoever owns those filesystems.

Remaining A8 work

  • — 56 occurrences. A package import, not a file path; needs a decision about whether Home's basics package is reachable from kernel code at all.
  • — 15 occurrences. Zig's standard library, which has no business in a freestanding kernel. Each is either dead or a real dependency that has to be replaced.
  • Extensionless path imports — , , and peers, ~50 occurrences. Same conversion, but the resolver has to agree on how a path without .home resolves before it is safe to do mechanically.
  • Zig-style function signatures — fn f(x: u64) u32 { without the colon. These parse today, so this is idiom rather than breakage.

A note on the codemod

The first attempt used \s*$ to match trailing whitespace. In multiline mode \s* crosses newlines, so it swallowed the blank line after each import run and merged the following statement onto the import line — parse-rate dropped 410 → 406. [ \t]*$ is the correct anchor. Worth remembering for the remaining conversions above, which are larger.

Related: #41 (link gate), #38 (codegen widening).

Sign in to comment on this issue.