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

re: PP'ing interpreted OBJECTs...

That looks like a bug to me, but there is something you can do if you are willing
to sacrifice some of the functionality of OBJECTs.  The problem seems to be coming\n from the fact that T thinks objects that are callable (ie that have a procedure   
associated with them) are procedures, not objects.  If you make your objects
uncallable, they pretty-print, so:

> (define foo1 (object ()
                       ((pretty-print self str) (format str "#{Foo1}"))))
#{Object 159}
> (pp foo1)


;; Notice that uncallable objects print as #{Object x} and that callable ones print 
;; as #{Procedure y}

> (define foo2 (object (lambda () 'value-of-foo)
                       ((pretty-print self str) (format str "#{Foo2}"))))
#{Procedure 158}
> (pp baz1)

** Error: operation not handled
>> *** EOF *** 

Unfortunately, operations also have the same pretty-printing problem.  *sigh*