On Thu, Sep 10, 2020 at 10:55 AM John Cowan <xxxxxx@ccil.org> wrote: >> With our retaining port-internal-fd, having terminal? take a port is duplicative, and I'm leaning strongly towards having terminal? only take an fd. > > > I agree, and I've changed the spec accordingly: fd only, with a note saying it's safe to use the value of port-internal-fd here. That seems to encourage the use of port-internal-fd, which is something I'd rather to fall back to only when absolutely necessary (and preferably only for logging). The procedures that take an fd typically would get that fd from open-file or similar procedures, not through fd->port then port-internal-fd. This may be out of scope, but what about (terminal? (current-output-port))? A C program typically does isatty(1) (or 0 or 2) to check if it's attached to a terminal and adjust itself accordingly. That translates to either (terminal? 1) or (terminal? (current-output-port)) in Scheme. I would prefer the latter as the current output port is not always "1" (output could be redirected to a string port, or something) and it feels less Schemey to just go with fd "1". Even in C sometimes people will use STDOUT_FILENO for clarity. -- Duy