3 ms·
> If I call write on a Writer, I expect it to write immediately. But you can't know what "to write" actually means. When you call write(2) on a POSIX system,
by PaulDavisThe1st 5y ago
> If I call write on a Writer, I expect it to write immediately.
But you can't know what "to write" actually means.
When you call write(2) on a POSIX system, what is it that you think happens immediately? Patterns of NVRAM storage are changed? Fluctuating voltage on a cat-5 cable wobbles a bit in response?
OK, maybe you can get away with saying "If I call write on a Writer I expect it to hand over the data to the kernel immediately", and that's somewhat reasonable. The problem is that such a design encourages beginner programmers to use unbuffered IO, which is generally the wrong thing to do.
- spoiler 5y agoThey're not encouraged to use unbuffered io. The documentation for FS and IO both point you in the direction of BufRead and explain why you might want it (in the intro section of each).