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

printing of procedures



    Date: Tue, 16 Jul 85 13:20:17 EDT
    From: Jeffrey Ira Grossman <Grossman at YALE.ARPA>

      When a procedure is printed, T outputs something like
    "#{Procedure 200 FORMAT}".  If I want procedures to print 
    differently (say, "#{FORMAT}" or "pFORMAT"), what do I
    have to change and how do I do it?

If you want a particular procedure to print differently, change

    (DEFINE (FOO X Y) ...)

to

    (DEFINE FOO
      (OBJECT (LAMBDA (X Y) ...)
	      ((PRINT SELF STREAM) (FORMAT STREAM "#{FOO}"))))

If you want ALL procedures to print differently, then the only released
way to make them print differently is by writing your own printer.  You
could use the source code for the T printer (in PRINT.T) as a model.
There is no released way to change the behavior of the PRINT operation's
default method (any such mechanism would violate T's "no global state"
principle, compromising modularity).

An unreleased way to change PRINT's default method is to clobber the
appropriate routine internal to the system; consult the source
code again (PRINT.T).  You'd end up doing something like
(*DEFINE *T-IMPLEMENTATION=ENV* 'PRINT-RANDOM (LAMBDA ...)) .

Jonathan