feat(lang): layers - module flow in layer app uses base, items

The modules of one layer use each other freely and may go round;
anything outside the layer is held to the module's uses, and a layered
module with no uses reaches nothing outside it. The cycle check walks
the graph with each layer as one node, so a cycle leaving a layer is
refused. ludic deps shows the layers and counts the largest cycle
without their own edges. Reseed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 12:54:15 +03:00
parent e3219f17dd
commit 7b8c134c21
20 changed files with 47359 additions and 46193 deletions

View file

@ -3,7 +3,7 @@
# of what it names, and every assignment to a global of another module is a write; the file lists
# the modules (their declared `uses`, and whether they are a package's), the edges with a count, and
# the writes, one a line:
# module <name> <package 0|1> <uses: -|,a,b,>
# module <name> <package 0|1> <uses: -|,a,b,> <layer: -|name>
# edge <from> <to> <count> <first name>
# write <owner> <global> <from> <file>:<line>
var g_dp_on: int = -1
@ -78,7 +78,9 @@ function deps_flush() -> void {
var uses: pointer = "-"
let k = mod_find_uses(m)
if k >= 0 { uses = g_mu_list[k] }
deps_line(f, `module {m} {itoa(pkg)} {uses}`)
var layer = mod_layer(m)
if (layer == "") { layer = "-" }
deps_line(f, `module {m} {itoa(pkg)} {uses} {layer}`)
}
i += 1
}
@ -94,7 +96,7 @@ function deps_flush() -> void {
}
if not dup and not (m == "") {
push(seen, m)
deps_line(f, `module {m} 1 -`)
deps_line(f, `module {m} 1 - -`)
}
i += 1
}