CLIM mail archive

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

Bug in filling-output?



    Date: Wed, 2 Dec 1992 06:44 EST
    From: berni@iml.fhg.de

    I'm using CLIM 1.1 with MCL 2.0 and Genera 8.1.

    Filling-output dies if it's used inside another filling-output.
    This restrcition is undocumented, and there is no specific error:
    Under Genera, it results in a stack-overflow, under MCL the systems
    waits until I break or abort (At least it doesn't crash the Mac!:-)

    So I suspect this behavior quite buggy.

    To answer the question why I want to call it recursively:
    1. It is e.g. necessary to implement a general "quote-context" like LaTeX's
       \quote.

    2. As indenting-output can't be used inside filling-output, I tried to
       emulate the indenting with the :after-line-break option of filling-output. 
       And I need serveral nested indent-levels inside a filled output!
       (with-flaming (:excuse "Already took some hours of testing and working around")
	  In my eyes the restriction of using indenting-output and filling-output
	  togehter is a typical hacker-driven software-"design". The
	  features of the software seem to be determined by the efforts of 
	  implementing them, not by analysing the USER's needs! And if some
	  function is restricted in use, it should be named properly. What do
	  you think of a function "multiply", where the doc says "... but the 
	  second argument must be a power of 2..."???)
	  And it is by far not enough to simply state in the docs that 
	  this and that is not possible --- without any motivation or explanation
	  how it could be emulated. )

Most of CLIM's design is driven by analyzing user's needs.  To the best
of my knowledge, practically nothing in CLIM is "typical hacker-driven
software design".  Note that there was no intention to include
FILLING-OUTPUT in CLIM at all, except that a number of users requested
that we do so during the CLIM 1.0 Beta test.

If you are accusing the implementors of CLIM of having to restrict the
functionality of some parts of CLIM because it has proved too difficult
to implement that functionality correctly, or with adequate performance,
or even at all, well, you're right.  We're just hackers, not miracle
workers.

In any event, the following does exactly what I expect in CLIM 2.0.

(defun foo (&optional (stream *standard-output*))
  (fresh-line stream)
  (indenting-output (stream '(2 :character))
    (filling-output (stream :fill-width '(40 :character))
      (dotimes (i 12)
	(write-string "outer1 " stream))
      (terpri stream)
      (indenting-output (stream '(2 :character))
	(filling-output (stream :fill-width '(20 :character))
	  (dotimes (i 15)
	    (write-string "inner " stream))))
      (terpri stream)
      (dotimes (i 12)
	(write-string "outer2 " stream)))))

Here is the output it produces, copied from a CLIM Lisp Listener window:

  outer1 outer1 outer1 outer1 outer1
  outer1 outer1 outer1 outer1 outer1
  outer1 outer1 
    inner inner inner
    inner inner inner
    inner inner inner
    inner inner inner
    inner inner inner 
  outer2 outer2 outer2 outer2 outer2
  outer2 outer2 outer2 outer2 outer2
  outer2 outer2 

By the way, if you expect to use FILLING-OUTPUT the same way you would
use a text formatter, you should realize that it is not intended to be
a general-purpose text formatter.  If you would like to write a more
sophisticated version of FILLING-OUTPUT and submit it to the would-be
CLIM library, I will be glad to provide assistance.

0,,

References:

Main Index | Thread Index