Ha, I just tried the same trick with Rust:
//$HOME/.cargo/bin/rustc "$0" && ${0%.rs} "$@" ; exit
use std::env;
fn main() {
println!("hello, world!");
for arg in env::args() {
println!("arg: {arg}");
}
}
Total hack, and it litters ./ with the generated executable. But cute.