riptide icon indicating copy to clipboard operation
riptide copied to clipboard

Contextual I/O

Open sagebind opened this issue 5 years ago • 0 comments

Make stdin, stdout, and stderr into normal context variables and make a "stream handle" a built-in type. Then we can do something like:

let @stdout = (open -w "message.txt") {
    println "Hello world!"
    fclose @stdout
}

All sorts of fun and useful programming abilities open up that many shells can't handle because you can't hold a file descriptor in a variable. Of course, it can also mean that users can leak file handles...

sagebind avatar Sep 03 '20 03:09 sagebind