Conversation
Window.open, frame, set_title and close each carried the X11 BendWin struct so any one of them compiled alone. The generated program then pasted that block four times. eff_src already skipped a path it had seen; a `// @src name.c` line now loads a sibling through that same set, and the four effects share window_host.c.
|
Rescuing PR by commenting (github issue) |
| return fs.readFileSync(path, "utf8"); | ||
| const dir = path.slice(0, path.lastIndexOf("/")); | ||
| return fs.readFileSync(path, "utf8").replace(/^\/\/ @src ([a-z0-9_]+\.c)$/gm, | ||
| (_: string, name: string) => eff_src(dir + "/" + name, seen)); |
There was a problem hiding this comment.
[P2] Include transitive @src files in published packages. pkg_files() in main.ts only collects direct Bend imports, so an effect containing // @src helper.c builds locally but leaves helper.c out of the package. I reproduced this by rebuilding from the files returned by pkg_files(); compilation fails with ENOENT for the helper. The package collector needs to follow these dependencies too.
| return fs.readFileSync(path, "utf8"); | ||
| const dir = path.slice(0, path.lastIndexOf("/")); | ||
| return fs.readFileSync(path, "utf8").replace(/^\/\/ @src ([a-z0-9_]+\.c)$/gm, | ||
| (_: string, name: string) => eff_src(dir + "/" + name, seen)); |
There was a problem hiding this comment.
[P2] Protect these helpers from output overwrite. The input set in cli_file() only tracks direct imports, so bend main.bend -o helper.c exits 0 and replaces a helper referenced through // @src helper.c with generated C. I reproduced the overwrite with a working custom effect. Add transitive helpers to the protected input set before emitting any output.
eff_src inlines a sibling .c while emitting, but the import list the CLI walks does not name it. --publish then shipped a package that could not rebuild, and -o helper.c exited 0 and replaced the helper with generated C. src_deps follows that same line, transitively. pkg_files packs those paths; cli_file refuses to overwrite them. Base stays out of a package, as before.
Same two call sites, one queue, one comment.
The four Window C effects each carried the X11
BendWinstruct (with includes) so any one of them compiled alone. A program that imports more than one then pasted that block four times, under an#ifndef BendWinconcatenate-guard.eff_srcalready skipped a path it had seen. A// @src name.cline now loads a sibling through that same set, so the four effects sharewindow_host.cand a program that imports more than one still emits the type once.This is the same
@srchelper as #949 (audio ring). If that lands first, thecomp.tshunk here is identical and drops on rebaseChecks
tests/gfx/*.bend--check-only: all check.tests/gfx/window.bendinterpret and JS: same#|pin as main (no display / ENOTSUP).window.bend(open+frame+close) and a scratch file that also callsset_title: oneBendWintypedef, one<X11/Xlib.h>, no leftover// @src.clang -O1of those programs with-lX11 -lpthread -lm: exit 0.Not run: the cluster gates, Metal, a machine with a display.
Runtime, checker, and JS are untouched. Window behavior is unchanged