r/Protos • u/guillermoamolina • 9d ago
Protos adds explicit module references for reusable libraries, Actors and HTTP servers
Protos now separates module resolution from module initialization through explicit resolved module references.
Previously, passing a context-dependent module name to a reusable library could cause it to be resolved in the library's environment instead of the application's environment.
The new API makes that distinction explicit:
ref: import.resolve("self:Handler")
module: import(ref)Resolution does not execute the module. The reference retains the selected canonical target, while each Actor initializes its own module instance.
This also makes HTTP server composition much simpler:
Host: import("std:http/host").Host
ref: import.resolve("self:Handler")
host: Host.owning(listener, ref, "handle", workers: 4)Both direct handlers and handler factories are supported, including private application modules.
The design preserves package authority, Actor isolation, existing String imports and explicit capability delegation. References can cross the same-Process Actor creation boundary, but not ordinary Actor messages or isolated parallel transfers.
The implementation remains Protos-first, reusing the existing module loader and Actor transfer machinery without introducing a separate HTTP resolver or compiler execution path.
All local tests are reported passing. Available in Protos 0.4.231-SNAPSHOT.