Re: Remove file descriptors completely from srfi-170?
Duy Nguyen 10 Sep 2020 15:59 UTC
On Thu, Sep 10, 2020 at 10:55 PM Lassi Kortela <xxxxxx@lassi.io> wrote:
>
> > Why not combine open-file and
> > fd->*port in one? All other procedures either take pathname or a port.
>
> POSIX open() takes a whole bunch of flags which are relevant when
> opening a pathname and don't have much to do with converting an
> already-existing fd to a Scheme port.
> <https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html>
So the new open-file also takes a bunch of flags and returns a port.
Since there's no way for you to get hold of an fd in the first place
(unless you count on special numbers 0, 1 and 2), converting an
already-existing fd to a Scheme port is a moot point.
--
Duy