diff --git a/bench/main.bend b/bench/main.bend index db013dc..1d0e4da 100644 --- a/bench/main.bend +++ b/bench/main.bend @@ -76,7 +76,7 @@ def die.msg(msg: String) -> IO(Unit): IO.die(Unit, 1, msg) # command plus three words; further words are ignored -def argv.3(a: String, b: String, c: String, xs: List) -> String & String & String & String: +def argv.w3(a: String, b: String, c: String, xs: List) -> String & String & String & String: match xs: case Nil{}: (a, b, c, "") @@ -84,28 +84,28 @@ def argv.3(a: String, b: String, c: String, xs: List) -> String & String (a, b, c, d) # third word -def argv.2(a: String, b: String, xs: List) -> String & String & String & String: +def argv.w2(a: String, b: String, xs: List) -> String & String & String & String: match xs: case Nil{}: (a, b, "", "") case c <> t: - argv.3(a, b, c, t) + argv.w3(a, b, c, t) # second word -def argv.1(a: String, xs: List) -> String & String & String & String: +def argv.w1(a: String, xs: List) -> String & String & String & String: match xs: case Nil{}: (a, "", "", "") case b <> t: - argv.2(a, b, t) + argv.w2(a, b, t) # split argv in one walk (the list is affine) -def argv.0(xs: List) -> String & String & String & String: +def argv.w0(xs: List) -> String & String & String & String: match xs: case Nil{}: ("", "", "", "") case a <> t: - argv.1(a, t) + argv.w1(a, t) # plain text content type def ctype.plain() -> String: @@ -610,7 +610,7 @@ def main.go.un(quad: String & String & String & String) -> IO(Unit): # unpack argv and run the named command def main.go(args: List) -> IO(Unit): - main.go.un(argv.0(args)) + main.go.un(argv.w0(args)) # CLI entry def main() -> IO(Unit): diff --git a/ezhttp/effs/wire.c b/ezhttp/effs/wire.c index 0a8672d..884ff78 100644 --- a/ezhttp/effs/wire.c +++ b/ezhttp/effs/wire.c @@ -338,5 +338,5 @@ Term ezwire_talk_run(Env e, Term* f, IoWork* w) { } static void __attribute__((constructor)) ezwire_talk_use(void) { - io_eff(CID_EZWIRE_TALK, ezwire_talk_run, 0); + io_eff(CID(ezwire.talk), ezwire_talk_run, 0); } diff --git a/ezhttp/effs/wire.js b/ezhttp/effs/wire.js index e2a72be..544aaa2 100644 --- a/ezhttp/effs/wire.js +++ b/ezhttp/effs/wire.js @@ -7,8 +7,9 @@ // same way too, with dlopen at run time, because neither lane has a link line // that could name -lssl. // -// Every name here is a `function`, never a top-level `const`: each effect's JS -// lands in one concatenated script, and a redeclared `const` there is fatal. +// The file runs once in a closure of its own and registers the effect at its +// foot with io_eff, as wire.c does. The helpers are still `function`s and the +// loaded libraries still live on globalThis, so each is opened once per process. // libc's resolver. io_sys() already carries the socket calls; getaddrinfo is // the one it does not, and it is the whole of ez's DNS. @@ -259,3 +260,5 @@ function ezwire_talk(spec) { io_sys().close(fd); return out; } + +io_eff(CID(ezwire.talk), ezwire_talk); diff --git a/flake.lock b/flake.lock index 21b5b2c..e2c72df 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1790348040, - "narHash": "sha256-6oh+6jj7kyl4xJsmq4p3BtU/BUl2f2LlC/5kH081D1M=", + "lastModified": 1790359392, + "narHash": "sha256-z0Xwg46QesyRnlb7+sQue2GRq90v9M2XVaNVVSdd5Vs=", "owner": "bendlang", "repo": "bend", - "rev": "774ef644dccf9c3f8053f7276d8901ad23da006c", + "rev": "11c65a2572e16d0bfc2e83068b23ed8fb180ccc0", "type": "github" }, "original": { @@ -20,11 +20,28 @@ "type": "github" } }, + "bend_2": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1790200275, + "narHash": "sha256-huYLnKbMUukFhFLypIXx/wLVU3EmgsUEe9l67mU6CDw=", + "owner": "bendlang", + "repo": "bend", + "rev": "d37909174ebd664338ae3194799a9e0899dedd51", + "type": "github" + }, + "original": { + "owner": "bendlang", + "repo": "bend", + "rev": "d37909174ebd664338ae3194799a9e0899dedd51", + "type": "github" + } + }, "ez": { "inputs": { - "bend": [ - "bend" - ], + "bend": "bend_2", "nixpkgs": [ "nixpkgs" ] @@ -44,6 +61,22 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1790185690, + "narHash": "sha256-xJ+X4hBtOcAFGBOe5nAMyMUeF9foJBmIOu3NjBqBycU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4975466d324710c576dc11ad614684e6bd8cad8e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1789921291, "narHash": "sha256-Ft/BRnIqw1MywFoXydKobjjWmDFgDdYtSpJliE8+yUw=", @@ -63,7 +96,7 @@ "inputs": { "bend": "bend", "ez": "ez", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" } } }, diff --git a/flake.nix b/flake.nix index ce0153e..966f41d 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,10 @@ inputs.ez = { url = "github:Emerging-Patterns/ez"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.bend.follows = "bend"; + # not `inputs.bend.follows = "bend"`: ez 1.2.0 does not build on bend + # 2.0.28, so ez (and `ez prove`, and bolt through mkLint) keep the bend + # ez 1.2.0 locks, 2.0.27 + inputs.bend.url = "github:bendlang/bend/d37909174ebd664338ae3194799a9e0899dedd51"; }; outputs = { self, nixpkgs, ... }@inputs: @@ -20,7 +23,7 @@ ez = inputs.ez.lib.${system}; ezBin = inputs.ez.packages.${system}.default; bend = inputs.bend.packages.${system}.default; - bolt = ez.toolPackage { name = "bolt"; src = self; inherit bend; wrapFlags = [ "--gpu" "off" ]; }; + bolt = ez.toolPackage { name = "bolt"; src = self; wrapFlags = [ "--gpu" "off" ]; }; bend-cc = ez.bend-cc; bench = import ./bench {