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

Issue: STREAM-ACCESS (version 1)



Issue:		STREAM-ACCESS
References:	streams (Chapter 21 of CLtL)
Category:	ADDITION
Edit History:	17-Jun-88, version 1 by Walter van Roggen

Problem Description:

  There are many components of streams which are specified upon creation
  but are not accessible afterwards.  Furthermore there is no way in
  Common Lisp to determine the type of a stream to see if it has particular
  components, or even if it is OPEN.

Proposal: (STREAM-ACCESS:PROVIDE)

  Add the following types and functions to the language:

  Stream Data Types and Predicates:

    BROADCAST-STREAM		[Type]
    BROADCAST-STREAM-P object	[Function]

      The predicate is true if the object is of type BROADCAST-STREAM
      and is false otherwise.  MAKE-BROADCAST-STREAM returns a stream
      of type BROADCAST-STREAM.

    CONCATENATED-STREAM		[Type]
    CONCATENATED-STREAM-P object [Function]

      The predicate is true if the object is of type CONCATENATED-STREAM
      and is false otherwise.  MAKE-CONCATENATED-STREAM returns a stream
      of type CONCATENATED-STREAM.

    ECHO-STREAM			[Type]
    ECHO-STREAM-P object	[Function]

      The predicate is true if the object is of type ECHO-STREAM
      and is false otherwise.  MAKE-ECHO-STREAM returns a stream
      of type ECHO-STREAM.

    FILE-STREAM			[Type]
    FILE-STREAM-P object	[Function]

      The predicate is true if the object is of type FILE-STREAM
      and is false otherwise.  OPEN returns a stream
      of type FILE-STREAM.

    STRING-STREAM		[Type]
    STRING-STREAM-P object	[Function]

      The predicate is true if the object is of type STRING-STREAM
      and is false otherwise.  MAKE-STRING-INPUT-STREAM and
      MAKE-STRING-OUTPUT-STREAM return a stream of type STRING-STREAM.

    SYNONYM-STREAM		[Type]
    SYNONYM-STREAM-P object	[Function]

      The predicate is true if the object is of type SYNONYM-STREAM
      and is false otherwise.  MAKE-SYNONYM-STREAM returns a stream
      of type SYNONYM-STREAM.

    TWO-WAY-STREAM		[Type]
    TWO-WAY-STREAM-P object	[Function]

      The predicate is true if the object is of type TWO-WAY-STREAM
      and is false otherwise.  MAKE-TWO-WAY-STREAM returns a stream
      of type TWO-WAY-STREAM.


  Stream Informational Functions:

    BROADCAST-STREAM-STREAMS broadcast-stream       ==> list of streams

      This function returns a list of output streams that constitute
      all the streams the broadcast stream is broadcasting to.  It is
      an error if the argument is not of type BROADCAST-STREAM.

    CONCATENATED-STREAM-STREAMS concatenated-stream ==> list of streams

      This function returns a list of input streams that constitute
      the ordered set of streams the concatenated stream still has to
      to read from, starting with the current one it is reading from.
      The list may be () if no more streams remain to be read.
      It is an error if the argument is not of type CONCATENATED-STREAM.

    ECHO-STREAM-INPUT-STREAM echo-stream            ==> input-stream
    ECHO-STREAM-OUTPUT-STREAM echo-stream           ==> output-stream

      These functions return the corresponding component stream.  It is
      an error if the argument is not of type ECHO-STREAM.

    SYNONYM-STREAM-SYMBOL synonym-stream            ==> symbol

      This function returns the symbol whose SYMBOL-VALUE the
      synonym stream is using.  It is
      an error if the argument is not of type SYNONYM-STREAM.

    TWO-WAY-STREAM-INPUT-STREAM two-way-stream      ==> input-stream
    TWO-WAY-STREAM-OUTPUT-STREAM two-way-stream     ==> output-stream

      These functions return the corresponding component stream.  It is
      an error if the argument is not of type TWO-WAY-STREAM.

  Predicate:

    OPEN-STREAM-P stream

      Returns T if a stream is open, NIL if it is closed.  It is an error
      if the argument is not a stream.

Current Practice:

  VAX LISP implements the proposal.

Cost to Implementors:

  Most of these should be trivial to implement, since the information
  must be present for nearly all types.

Cost to Users:

  None.  This is an upward-compatible extension.

Cost of Non-Adoption:

  The benefits would not be available in a portable fashion.

Benefits:

  Programs would be able to access useful information otherwise hidden.

Discussion:

  This issue has come up frequently, particularly dealing with SYNONYM-STREAMs.
------