[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue: STREAM-CAPABILITIES



[Added back the CL-Cleanup mailing list]

    Date: 24 May 89 06:28
    From: chapman%aitg.DEC@decwrl.dec.com

    >  Add the following function:
    > 
    >    INTERACTIVE-STREAM-P stream
    > 
    >    Returns T if the stream is interactive, otherwise NIL.  Signals
    >    an error of type TYPE-ERROR if the argument is not a stream.

    I thought that in most cases, if the argument to a function is not
    of the right type, the results are unspecified, but if the implementation
    were to signal an error, it would be of type TYPE-ERROR. Why is this
    one different?

I was under the impression that most functions "signal an error" for
wrong type arguments, except for some that "should signal an error" for
efficiency reasons, and some that "might signal an error" for implementation
flexibility reasons.  Clearly neither of those reasons applies to
INTERACTIVE-STREAM-P, which need not be extra fast and is not tightly
coupled to implementation data or control structures.  Hence I proposed
it in the "signals an error" category.

    Also, I think the "definition" of interactive later in this proposal is
    too vague to be portably useful, unless, in the spec, we change the
    wording from "Some examples of..." to "If a stream is... then it is 
    interactive" or something like that.

It's not possible to make a specific definition of "interactive" that
applies to all operating systems, I concluded from earlier discussion.
However, "everyone knows" appoximately what it means.  Hence the idea
of describing it by example rather than defining it.

Would it be better to take this alternate, minimalist approach:

    INTERACTIVE-STREAM-P stream

    If the argument is a stream, returns T or NIL at the discretion of the
    implementation and its underlying operating system.  The general intent
    is to distinguish between interactive and batch (or background or
    command-file) operations.

    Signals an error of type TYPE-ERROR if the argument is not a stream.

    *TERMINAL-IO* might or might not be interactive.