4 ms·
I’m not sure I’d use the Unix io interface as a shining example of reducing cognitive load. Sure, it’s a simple interface on the surface but… Let’s just take w
by ipython 2y ago
I’m not sure I’d use the Unix io interface as a shining example of reducing cognitive load. Sure, it’s a simple interface on the surface but…
Let’s just take write() as an example. Just calling write() does not guarantee that the full contents were written to the file. You could have the case where write() wrote nothing, or some data, but was interrupted because of a signal before it completed. Or you could have a short write because of a quota or disk limit.
And I’m sure I’ll be nerd sniped shortly with even more obscure examples of the sharp edges awaiting you in such a “simple” interface. (For a more snarky version of my comment, see the last essay “the rise of worse is better” of the Unix haters handbook: https://web.mit.edu/~simsong/www/ugh.pdf https://web.mit.edu/~simsong/www/ugh.pdf)
Point is, this interface just shifts cognitive load on to the application developer - it’s got to go somewhere after all.
- C-programmer 2y ago`write` can format your disk if a trickster sets LD_PRELOAD to a malicious shared object.
- nateglims 2y agoSo much is crammed into ioctl or fcntl. Especially if you are trying to treat UART, SPI, I2C, etc the same by supplying the I/O interface.