raz / commit 14be7cfb

commit
14be7cfb886b9612f8cc39f0131d7d760d476c69
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
566b557b
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.

patch · log

2 files changed, +37 -0

PLAN.md (history) modified +19 -0

@@ -487,3 +487,22 @@
487487 stopped by `kill`; `readyOf` on two pipes; `connect` refused on
488488 a path with nothing at it, and taken by a listener the test
489489 makes with Python, in `test/libc` and beside the library's own.
490+
491+Stage 8: one module to a name, report 2026-10.5
492+
493+A module found in two directories was taken from the first, silently,
494+by every module that imports it: a program's `C.raz` stood in for the
495+library's `C` inside `Rt`, and the compiler said only "Rt imports
496+itself". Not started: each step waits for the owner's word.
497+
498+- [x] 50. The report, version 2026-10.5: one module to a name, the
499+ link that chooses a file, libraries' prefixes (section 3), for
500+ review before any code.
501+- [ ] 51. `ModuleFile` goes on through the later directories once it
502+ has found a module's file, and an error names the files of each
503+ other directory that has the module, unless the file found is a
504+ symbolic link to one of them (compared by device and inode). A
505+ test in `test/err` with a `C.raz` of its own; `test/libc`, and
506+ ravite's `ravite-c`, still build through their link to
507+ `lib/Sys.raz`. `Report` in `src/raz.pas` goes to 2026-10.5
508+ with it, or with step 49, whichever comes last.

doc/raz.md (history) modified +18 -0

@@ -174,6 +174,21 @@
174174 don't change. Machine code (section 8) and system calls belong in such
175175 files.
176176
177+**One module to a name.** A program has one module of each name, so
178+the compiler reports an error, naming the files, if a module it looks
179+for has files in more than one of these directories, rather than take
180+the first: a `Buf.raz` beside a program would otherwise stand in for
181+the library's `Buf` in every module that imports it, the library's own
182+among them. A link is the exception: a file that is a symbolic link to
183+one of the module's files in a later directory chooses that file, so
184+that a directory holding a link to `lib/Sys.raz` builds a program over
185+the C library's `Sys` on Linux too.
186+
187+Since the names of a program's modules are one space, the modules of
188+a library share a prefix of their own, as an X11 library's `Xauth` and
189+`Xkeys` do, and programs leave the library's short names (`Buf`,
190+`Map`, `Out`, `C` and the rest of section 11) to it.
191+
177192 The compiler holds every file of such a module to the same interface.
178193 When it takes one of `Name.*.raz`, it also reads the declarations of
179194 the others beside it, and of `Name.raz` if there is one, and reports an
@@ -1045,3 +1060,6 @@
10451060 - **2026-10.4.** `Sys` gains a connection to a Unix socket, waiting on
10461061 several files at once, pseudo-terminals, and starting, waiting for
10471062 and stopping programs (section 11).
1063+- **2026-10.5.** A module with files in more than one of the
1064+ directories searched is an error, unless the first is a link to one
1065+ of the others (section 3).