|
|
|
|
|
by valarauca1
4114 days ago
|
|
Lazy evaluation with pipes would be problematic because alerts/echos would be ignored by default as they are necessarily part of the stdin/stdout chain. I.E.: This section of code let a = "some_file_name".as_string();
println!("Opening: {}", a);
let path = std::path(a);
let mut fd = std::io::open(path);
would get optimized to let mut fd = std::io::open(std::path("some_file_name".as_string()));
with strict lazy evaluation. The user feedback is removed, which is a big part of shell scripting. |
|
I guess an OS should be functional at its interface to the user, and only imperative deep down to keep things running efficiently.
However, note that this hypothetical functional layer on top also would ensure efficiency, as it enables lazy evaluation. This type of efficiency could under certain circumstances be even more valuable than the bare-metal performance of system programming languages.