From 14be7cfb886b9612f8cc39f0131d7d760d476c69 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Sun, 11 Oct 2026 11:11:12 +0100 Subject: [PATCH] The report, for review: one module to a name (2026-10.5) A module with files in more than one directory searched is an error naming them, instead of the first silently standing in for the others everywhere, the library's own imports included. A symbolic link to one of the later files chooses it, as test/libc's link to lib/Sys.raz does. Libraries prefix their modules and leave the library's short names alone. PLAN.md: stage 8, not started. --- diff --git a/PLAN.md b/PLAN.md index 1f557a9..6c3e4da 100644 --- a/PLAN.md +++ b/PLAN.md @@ -487,3 +487,22 @@ stopped by `kill`; `readyOf` on two pipes; `connect` refused on a path with nothing at it, and taken by a listener the test makes with Python, in `test/libc` and beside the library's own. + +Stage 8: one module to a name, report 2026-10.5 + +A module found in two directories was taken from the first, silently, +by every module that imports it: a program's `C.raz` stood in for the +library's `C` inside `Rt`, and the compiler said only "Rt imports +itself". Not started: each step waits for the owner's word. + +- [x] 50. The report, version 2026-10.5: one module to a name, the + link that chooses a file, libraries' prefixes (section 3), for + review before any code. +- [ ] 51. `ModuleFile` goes on through the later directories once it + has found a module's file, and an error names the files of each + other directory that has the module, unless the file found is a + symbolic link to one of them (compared by device and inode). A + test in `test/err` with a `C.raz` of its own; `test/libc`, and + ravite's `ravite-c`, still build through their link to + `lib/Sys.raz`. `Report` in `src/raz.pas` goes to 2026-10.5 + with it, or with step 49, whichever comes last. diff --git a/doc/raz.md b/doc/raz.md index b3f8123..9ead1d4 100644 --- a/doc/raz.md +++ b/doc/raz.md @@ -174,6 +174,21 @@ don't change. Machine code (section 8) and system calls belong in such files. +**One module to a name.** A program has one module of each name, so +the compiler reports an error, naming the files, if a module it looks +for has files in more than one of these directories, rather than take +the first: a `Buf.raz` beside a program would otherwise stand in for +the library's `Buf` in every module that imports it, the library's own +among them. A link is the exception: a file that is a symbolic link to +one of the module's files in a later directory chooses that file, so +that a directory holding a link to `lib/Sys.raz` builds a program over +the C library's `Sys` on Linux too. + +Since the names of a program's modules are one space, the modules of +a library share a prefix of their own, as an X11 library's `Xauth` and +`Xkeys` do, and programs leave the library's short names (`Buf`, +`Map`, `Out`, `C` and the rest of section 11) to it. + The compiler holds every file of such a module to the same interface. When it takes one of `Name.*.raz`, it also reads the declarations of the others beside it, and of `Name.raz` if there is one, and reports an @@ -1045,3 +1060,6 @@ - **2026-10.4.** `Sys` gains a connection to a Unix socket, waiting on several files at once, pseudo-terminals, and starting, waiting for and stopping programs (section 11). +- **2026-10.5.** A module with files in more than one of the + directories searched is an error, unless the first is a link to one + of the others (section 3).