It's weird how even pure languages tend to treat the Unix execution model as ambient state.
Are there any PLs that define a main function like this?
fn main(args, stdin, stdout, env) -> exit code
Env = Map<String, String>
Args = [String]
UnixCommand = (Env, Args, ByteStream) -> (Integer, ByteStream, ByteStream)
Unix command compose pretty darn well, but it's a really weird API. Many of these inputs and outputs are less visible to newcomers too.
I'm coming round to the view that a main function shouldn't take arguments.
For example, in Rust you have to call std::env::args() to get CLI arguments.
This makes Hello World less verbose, and gives you more flexibility in setting up CLI argument parsers.
Wilfred Hughes
Shared words: args, env, main, function
Score: 144.7