This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Print form for classes?


What's a good default print form for classes?  We have a macro called
define-bean that is a wrapper around define-simple-class.  define-bean
creates a new class and (among other things) automatically makes a
toString method.  My question is: what's a good default for that method?

Right now we print it out as a vector:

    #|kawa:10|# (define-bean <Foo> () (a) (b init: 9) (c init: "hello"))
    #|kawa:11|# (make <Foo>)
    #(<Foo> a: #!null b: 9 c: "hello")

which isn't great.  We could also print out the code that would recreate
the instance:

    #|kawa:17|# (make <Foo>)
    (make <Foo> a: #!null b: 9 c: "hello")

Which is better?  Can anyone think of a good third solution? 

Regards,
Chris Dean


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]