4 ms·
The best approach I've heard is to "standardize" on doing it with IO descriptors, so we'd have stdin, stdout, stderr, stdjsin, stdjsout. Individual programs cou
by flukus 6y ago
The best approach I've heard is to "standardize" on doing it with IO descriptors, so we'd have stdin, stdout, stderr, stdjsin, stdjsout. Individual programs could check which file descriptors are open and read/write the format automatically. This may also be the best way to leverage the benefits of plain text and structured data and move between them quite naturally as the situation demands. It's also really not that hard to write a few basic utils or fork old ones to the new scheme as a proof of concept, but AFAIK no one ever has.
While we're here I'd also like to see more experimentation on using file desciprtors with GUI/TUI tools. I've had good like using things like vim in the middle of a pipe for data that needs a human touch before being passed through. The suckless world uses dmenu quite a bit.
- mjevans 6y agoA piped array of "octets" (C style character bytes, like void*) of nil or more length is probably the most basic interface possible for relevant hardware. A structured interface introduces much more complexity. Rather than standardize on any specific 'wire' format a better approach might be to have a bi-directional connection and a standard for negotiating across it. This might allow different forms of communication (E.G. a shared ringbuffer), negotiation of protocols, signaling when ready / blocked / needing more to proceed, what format(s) to use and if multiple streams should be used (as well as how to multiplex them)... etc. Programs might even be added to the middle to setup the preferences between two applications and then tell the OS that they're done and to just connect the input and output directly.