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

:Structure-Print and *print-level*



Introducing magic hidden variables and kludgey recursive-p arguments to control
them is inviting disaster.  I'm strongly opposed to this.  We've had some experience
with this in Zetalisp and it is not good.  It is always better to pass this kind
of state around as explicit arguments than to put it in hidden variables.

I fail to see what was wrong with the suggestion in Fahlman's original message of
adding a :DEPTH argument to WRITE, which defaults to 0 but can be supplied by a
structure's print function if it so desires.  

I should think the answer to the question of whether a structure's print
function should increment the depth that it received as an argument
before passing it on to WRITE is perfectly obvious:  it depends on
whether the print function printed any left parentheses before calling
WRITE.  I think the fact that the print system has no reasonable way to
tell whether the print function printed any left parentheses, other than
the print function telling it so, counters Greek's argument that the old
thing should be automatic.  Suppose the print function uses brackets as
part of its syntax and wants them treated as equivalent to a level
of parentheses for depth-abbreviation purposes.

I'm not concerned about the case of print functions that call FORMAT.  FORMAT is
a convenient abbreviation mechanism for writing code to do simple forms of
formatting quickly.  If you need to do something more complicated, you don't add
a new feature to FORMAT, you use Lisp instead of the FORMAT string language.