Why does --script discourage use of *TTY*?

Richard M Kreuter via Sbcl-help <[email protected]> Mon, 18 Nov 2024 13:12:33 -0500
Newsgroups gmane.lisp.steel-bank.general
Message-ID <[email protected]>
Hi all,

Does anybody know why --script configures the I/O customization
variables & *TERMINAL-IO* to avoid the tty?

https://github.com/sbcl/sbcl/blob/697e836ab233d7e88af21899fd1928fd3f466da5/src/code/toplevel.lisp#L378

Here's why I ask: my mental models include such things as

(a) A Lisp program is supposed to query the user on *QUERY-IO*, so that
    querying works even if *STANDARD-INPUT* or *STANDARD-OUTPUT* are
    rebound.

(b) A Unix program can query on /dev/tty so that querying works even if
    stdin or stdout are redirected away from the terminal.

So I'd expect *QUERY-IO* to initially be configured to read from & write
to the terminal whenever an SBCL process has a controlling terminal at
startup. (And I'm not sure I'd ever want, say, YES-OR-NO-P to read
from a process's stdin or write to its stdout unless I've configured
*QUERY-IO* in a custom way.)

So I'm wondering if anybody knows a technical reason why it would be bad
to for a script to reassign *TERMINAL-IO* to its normal value, i.e.,

  (setq *terminal-io* sb-sys:*tty*) ;--script leaves *QUERY-IO* a synonym
                                    ; to *TERMINAL-IO*.

Is it just whether to do EOF handling on reads from *TTY*? Or something
to do with typeahead & buffering when stdin is the terminal?

And then the analogous question about *DEBUG-IO* for scripts that enable
debugging.

Thanks in advance,
Richard