Subject: Re: ABCs of Streams, CMUCL flavors
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 10 Apr 2009 04:46:22 -0500
Newsgroups: comp.lang.lisp
Message-ID: <fqWdnc773bnziELUnZ2dnUVZ_iydnZ2d@speakeasy.net>
GP lisper  <spambait@clouddancer.com> wrote:
+---------------
| Built in to my CMUCL image is some implementation of 'streams'.  They
| probably follow the ANSI spec.  I've just blindly utilized them for
| reading and writing text, sometimes over telnet and otherwise with
| disk files.
| 
| In the cmucl distribution, there is an extras package which contains 3
| libraries called
| 
| simple-streams-library.x86f
| gray-streams-library.x86f
| gray-compat-library.x86f
| 
| First, what the heck is 'simple-streams', as I would expect that in
| the ANSI spec conformant image.
+---------------

Look here:

    http://www.cliki.net/simple-stream
    Simple-streams are Franz's proposal for a Gray-streams replacement
    and probably count as a Library. The specification is available at
    http://www.franz.com/support/documentation/6.2/doc/streams.htm.

    A CMUCL implementation of simple-streams by Paul Foley was released
    in version 19a.

    SBCL has a partial implementation; see the documentation.

    [Neither] CLISP nor OpenMCL appear to have an implementation. 

Also see "$CMUCL/src/docs/cmu-user/simple-streams.tex":

    \cmucl{} includes a partial implementation of \emph{Simple Streams}, a
    protocol that allows user-extensible streams\footnote{This
    implementation was donated by Paul Foley}. The protocol was proposed
    by Franz, Inc. and is intended to replace the \emph{Gray Streams}
    method of extending streams. Simple streams are distributed as a
    \cmucl{} subsystem, that can be loaded into the image by saying

    \begin{lisp}
       (require :simple-streams)
    \end{lisp}

    Note that CMUCL's implementation of simple streams is incomplete, and
    in particular is currently missing support for the functions
    \code{read-sequence} and \code{write-sequence}. Please consult the
    \textit{Allegro Common Lisp} documentation for more information on
    simple streams.

+---------------
| Gray streams are suppose to be 'better' in some mysterious way...
+---------------

Not all that "mysterious":

    http://www.cliki.net/Gray%20streams
    "Gray Streams" are a generic function wrapping of the COMMON-LISP
    streams in the standard library, allowing for further specialization
    by end users.

    This interface was proposed for inclusion with ANSI CL by David
    N. Gray in Issue STREAM-DEFINITION-BY-USER. The proposal did not
    make it into ANSI CL, but most popular CL implementations implement
    this facility anyway.
    ...

+---------------
| and gray-compat is apparently some sort of combination of simple and gray.
+---------------

Not so much a "combination" as a thin shim layer on top of simple-streams
that lets you user the Gray Streams API with simple-streams. See
"$CMUCL/src/pcl/simple-streams/gray-compat.lisp" [in CMUCL-19e or later].

Also see <http://www.cliki.net/trivial-gray-streams>.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607