Repository navigation
refactor(effects): inline one-use C result adapters - #981
nicolas-abril merged 2 commits into
Conversation
|
Thank you, both inlines read right: we walked every path in Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself. |
TCP.listen had the same one-use C helper as get_env and udp_bind: an output pointer plus a second error check in its run function. Fold it into tcp_listen_run so it returns the Bend result directly. The socket still closes on every failure and errno is saved before the close. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
@nicolas-abril |
|
Thanks @tachytelicdetonation! The tcp_listen fold reads right and matches the other two, every failure path still closes the socket, and the TCP, UDP and get_env tests pass in the C lane on top of current main. Merging 🙏 |
Nine C effects spelled "Fail on w->code, else Done(v)" by hand. io_res in the runtime's Io section says it once; being a macro, v is still only built on success. Effects on a handle still spell out the tuple that hands it back. print.c and write.c lose their one-use adapters, as get_env.c and udp_bind.c do in bendlang#981. Co-Authored-By: Claude Opus 5.5 <[email protected]>
IO.get_envandUDP.bindeach had a C helper with one caller, an output pointer, and a second error check in the effect handler. Fold the helper into that handler so it returns the Bend result directly.Net −27 lines / −136 ttok, across two effect files. The environment lookup still rejects embedded NULs and reports ENOENT for misses. UDP still validates the port, closes a failed socket, and saves errno before closing. No comments or features removed.
Verification on macOS arm64:
a4952426).git diff --checkpassed.The private cluster test/performance gates and Linux execution were not run.