Behavior
A Bend program’s IO.args() list is the process arguments after the runtime strips its own flags (--threads, --gpu, --gpu-build, --help). It does not include argv[0] (the executable / script path).
So a compiled or JS-emitted CLI cannot recover its own invocation name for usage text, relative resource paths, or re-exec, without a foreign effect or an external wrapper.
Minimal example
# args_demo.bend
import Base
def widen(ss: List<&1, String>) -> List<&2, String>:
match ss:
case Nil{}:
Nil{}
case Con{s, t}:
s <> widen(t)
def show_all(ss: List<&2, String>) -> String:
match ss:
case Nil{}:
"(none)"
case Con{h, t}:
"[" ++ h ++ "] " ++ show_all(t)
def main() -> IO(Unit):
do IO<Unit>:
ss : List<&1, String> <- IO.args()
IO.print(show_all(widen(ss)))
bend args_demo.bend -o args_demo.js
node args_demo.js hello world
# prints: [hello] [world] (none)
# not: [<path-to-args_demo.js>] [hello] [world] (none)
node args_demo.js
# prints: (none)
(Same shape on a native -o binary once clang is available.)
Request
Prefer one of:
- Prepend argv[0] to
IO.args(), or
- Add a dedicated
IO.program_name() -> IO(String) (or similar) that returns argv[0] without changing the existing args list.
Goal: a Bend CLI can print usage: <name> … and locate itself the way users expect.
Behavior
A Bend program’s
IO.args()list is the process arguments after the runtime strips its own flags (--threads,--gpu,--gpu-build,--help). It does not include argv[0] (the executable / script path).So a compiled or JS-emitted CLI cannot recover its own invocation name for usage text, relative resource paths, or re-exec, without a foreign effect or an external wrapper.
Minimal example
(Same shape on a native
-obinary once clang is available.)Request
Prefer one of:
IO.args(), orIO.program_name() -> IO(String)(or similar) that returns argv[0] without changing the existing args list.Goal: a Bend CLI can print
usage: <name> …and locate itself the way users expect.