I have a pre-SRFI at <https://bitbucket.org/cowan/r7rs-wg1-infra/src/default/FilesAdvancedCowan.md>. I think the SRFI 170 list is currently the best place to review and discuss this.
1) There are flags applicable to any procedure (R7RS-small or SRFI 170) that returns a port. These are currently specified as a plist, but would work very well using keyword arguments, which is why SRFI 177 is copied here. The current set:
a) append (not in R6RS, but really important IMO)
b) bidirectional (allows both input and output on the same port, but a bidirectional input port is not necessarily the same as a bidirectional output port; different things may happen at open time)
c) create (Posix: create the file if it doesn't exist)
d) truncate (Posix: truncate the file to zero length if it does exist)
e) exclusive (Posix: fail if the file exists)
f) buffer (size of buffer if any)
g) char-buffer (size of buffer for conversion between characters and bytes)
h) encoding (name)
i) newline (what the `newline` function outputs)
j) encoding-error (what to do if bytes can't be decoded to characters properly)
k) posix-permissions (when a file is created, what permissions to use; this is _not_ equivalent to creating with one set of permissions and then changing them).
2) The R6RS port positioning package: determine if a port's position can be accessed or modified, and then accessing or modifying it
3) From scsh, select at the level of ports, with timeout. There are two versions, one that ignores any buffers and one that respects them.
Which of these, if any, are necessary, merely convenient, or downright dispensable? Please comment.
There are also convenience procedures and macros that don't urgently need discussion.