Re: two questions on file modes Lassi Kortela 27 Jul 2020 06:09 UTC

> SRFI 170, however, is designed to provide a minimum of either fd or port
> operations.

> You can translate between one and the other, but the
> intention is to use ports internally and fds only externally.

That makes sense when a mismatch between ports and fd's is in question,
i.e. the fd has some property that should be mirrored in the port
object, and a discrepancy can develop between the fd's and the port
object's idea of that property.

However, some operations merely act on the underlying file. Then I don't
think it matters very much, since Scheme won't get out of sync and being
able to pass either a port or an fd is convenient.

> IMO, if you have a stale pathname, you are most likely doing the Wrong
> Thing anyway.

It's a surprisingly common problem in long-running programs. For
example, a shell should cope with the situation where the pathname for
the current directory disappears from underneath. Programs are not
always in control of doing the right thing since another unrelated
program can mess things up.