This looks a lot like an idea I am having for a shell written in GNU Guile. MI am still at the very beginning and POC phase. My ideas are:
(1) making it possible to have any procedure that follows a certain interface to be usable as a "command" in the shell
(2) have a fallback function, that gives you a procedure for a standard shell command like 'ls' (or reimplement your own!)
(3) have piped commands automatically use lightweight processes (guile-fibers) to automatically parallelize work, if possible
(4) pass structured data instead of strings, unless the structured data is actually a string or a fallback command of standard shell is used (although perhaps one could write functions parsing that string output into structured data and have structured data at the next step ...)
(5) provide composition concepts, that make it easy to compose commands or pipe their outputs into other commands
(6) have readable arguments for things like input or output redirection
(7) no need to be POSIX compatible, I just want a useful tool for myself and anyone, who might want to try it at some point. Don't want to get mired in arcane stuff.
Well, many things to consider, probably tons of work hiding somewhere under the hood of all this. I also noticed there are issues with parallelizing things, if I want to keep the shell state local to a command. Previous commands in a pipeline would have to communicate shell state updates down the pipeline. So one needs to distinguish between communication of a shell state update and more input for the next command. Concurrency issues might ensue. I think I will be glad, if I can get some subset of my goals to work.