This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Making 'write' use my own way of presenting defined classes
- From: Jocelyn Paine <popx at ifs dot org dot uk>
- To: kawa at sources dot redhat dot com
- Date: Sat, 13 Jul 2002 06:33:26 +0100 (BST)
- Subject: Making 'write' use my own way of presenting defined classes
If I define a new class with define-class or define-simple-class (I
usually do the latter, for efficiency), can I make the built-in output
functions such as 'write' and 'format' call my own function for converting
instances of the class to a string?
I tried this by defining a toString method in one of my classes:
(define-simple-class <indexed-name> () (attr <symbol>)
(indices <list>)
((toString) :: <java.lang.String>
(indexed->string (this))
)
)
where indexed->string is my own function, but 'write' still outputs
in the customary
indexed@97289f89
manner, opaque to people wanting to view its fields.
Jocelyn Paine
http://www.ifs.org.uk/~popx/
+44 (0)7768 534 091