Changeset 13254


Ignore:
Timestamp:
03/20/11 20:25:03 (13 years ago)
Author:
Mark Evenson
Message:

Reformat to 80 columns

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/doc/design/streams/design.rst

    r12410 r13254  
    66-------------------
    77
    8 Previously, ABCL streams were built-in classes. This presented some problems for Gray streams,
    9 because ABCL CLOS can't use a built-in class as a base class, and Gray streams derive from
    10 a system-stream class. This was corrected by converting ABCL streams to be structure-objects
    11 instead of built-in classes, allowing CLOS to derive from the streams. There was, however, another
    12 problem that revealed a need to change the design in more drastic ways.
     8Previously, ABCL streams were built-in classes. This presented some
     9problems for Gray streams, because ABCL CLOS can't use a built-in
     10class as a base class, and Gray streams derive from a system-stream
     11class. This was corrected by converting ABCL streams to be
     12structure-objects instead of built-in classes, allowing CLOS to derive
     13from the streams. There was, however, another problem that revealed a
     14need to change the design in more drastic ways.
    1315
    1416The problem with the previous design
    1517~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1618
    17 While converting the streams from built-in classes to structure-objects allowed derivation,
    18 the pretty printer still didn't work with Gray streams. Gray streams replace the system stream
    19 functions, saving the old function symbols so that they can be later invoked. The pretty printer,
    20 however, just replaces the stream functions, and calls the low-level primitives directly, thus
    21 bypassing Gray streams completely. The attached image portrays the problem, where pprint will,
    22 for example, invoke %stream-write-char, thus bypassing any methods that there may be for
    23 stream-write-char using Gray streams.
     19While converting the streams from built-in classes to
     20structure-objects allowed derivation, the pretty printer still didn't
     21work with Gray streams. Gray streams replace the system stream
     22functions, saving the old function symbols so that they can be later
     23invoked. The pretty printer, however, just replaces the stream
     24functions, and calls the low-level primitives directly, thus bypassing
     25Gray streams completely. The attached image portrays the problem,
     26where pprint will, for example, invoke %stream-write-char, thus
     27bypassing any methods that there may be for stream-write-char using
     28Gray streams.
    2429
    2530.. image:: pprint-problem.png
     
    2833-----------------------------------------------------
    2934
    30 The solution to the problem is quite similar to how SBCL does its streams. First of all, the pretty printer will
    31 no longer replace stream functions. The stream functionality will be based on closures in the slots of
    32 the structure-object representing the stream, and those closures will invoke low-level i/o functions that
    33 are stream-specific.
     35The solution to the problem is quite similar to how SBCL does its
     36streams. First of all, the pretty printer will no longer replace
     37stream functions. The stream functionality will be based on closures
     38in the slots of the structure-object representing the stream, and
     39those closures will invoke low-level i/o functions that are
     40stream-specific.
    3441
    35 The pretty printer will just setup closures that will extract the underlying stream
    36 object from a pprint-wrapped stream, and invoke its low-level functions. If pprint wrapping isn't present,
    37 the slots will contain closures that directly invoke low-level functions of streams. Gray streams will
    38 still replace the stream functions, because it's capable of invoking the replaced functions.
     42The pretty printer will just setup closures that will extract the
     43underlying stream object from a pprint-wrapped stream, and invoke its
     44low-level functions. If pprint wrapping isn't present, the slots will
     45contain closures that directly invoke low-level functions of
     46streams. Gray streams will still replace the stream functions, because
     47it's capable of invoking the replaced functions.
    3948
    40 In addition to these changes, it is planned that the stream function primitives will be moved from the Stream
    41 java class to a streamfunctions library, allowing the stream functions to be written in lisp rather than java.
    42 There's an ongoing aspiration to increase the lisp/java code ratio of ABCL, and this new design allows for that.
     49In addition to these changes, it is planned that the stream function
     50primitives will be moved from the Stream java class to a
     51streamfunctions library, allowing the stream functions to be written
     52in lisp rather than java.  There's an ongoing aspiration to increase
     53the lisp/java code ratio of ABCL, and this new design allows for that.
    4354
    4455.. image:: pprint-solution.png
Note: See TracChangeset for help on using the changeset viewer.