Some comments
Duy Nguyen
(09 Sep 2020 11:38 UTC)
|
||
Re: Some comments
hga@xxxxxx
(09 Sep 2020 13:14 UTC)
|
||
Re: Some comments
Duy Nguyen
(09 Sep 2020 14:06 UTC)
|
||
Re: Some comments
John Cowan
(10 Sep 2020 02:05 UTC)
|
||
Re: Some comments
hga@xxxxxx
(10 Sep 2020 03:06 UTC)
|
||
Re: Some comments
hga@xxxxxx
(10 Sep 2020 03:21 UTC)
|
||
Re: Some comments
John Cowan
(10 Sep 2020 03:55 UTC)
|
||
Re: Some comments
Duy Nguyen
(10 Sep 2020 09:17 UTC)
|
||
Re: Some comments hga@xxxxxx (10 Sep 2020 14:43 UTC)
|
||
Re: Some comments
Duy Nguyen
(10 Sep 2020 15:35 UTC)
|
||
Re: Some comments
hga@xxxxxx
(10 Sep 2020 14:26 UTC)
|
||
Re: Some comments
John Cowan
(10 Sep 2020 15:39 UTC)
|
||
Re: Some comments
Duy Nguyen
(10 Sep 2020 09:29 UTC)
|
||
Re: Some comments
Alex Shinn
(10 Sep 2020 13:01 UTC)
|
||
(missing)
|
||
Fwd: Some comments
John Cowan
(10 Sep 2020 16:25 UTC)
|
||
Re: Fwd: Some comments
hga@xxxxxx
(10 Sep 2020 18:16 UTC)
|
||
Re: Fwd: Some comments
John Cowan
(10 Sep 2020 18:21 UTC)
|
> From: Duy Nguyen <xxxxxx@gmail.com> > Date: Thursday, September 10, 2020 4:16 AM > > 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. While I see your point, I'd counter by saying it's good to show one safe example use of port-internal-fd in the SRFI doc. Logging is also covered by a full implementation of the SRFI, by using open-file with open/append, then fd->*-output-port with the buffer/line or buffer/none optional argument. Logging was in fact the use case that motivated the addition of these fd->*-output-port optional arguments, otherwise open/append made no sense as an open-file option. > This may be out of scope, but what about (terminal? (current-output-port))? That should work if you wrap (current-output-port) in port-internal-fd?, i.e. (terminal? (port-internal-fd (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. - Harold