From: Erik H. <eh...@gm...> - 2009-01-10 19:29:58
|
Hi Alessio, On Sat, Jan 10, 2009 at 12:24 AM, Alessio Stalla <ale...@gm...> wrote: > On Fri, Jan 9, 2009 at 11:04 PM, Ville Voutilainen > <vil...@gm...> wrote: >> Ok, a dumb question: does this work differently between compiler/interpreter? >> I have to say I've never really looked into how abcl does print/format, and we >> have some reported errors there, so I cannot really give guidance wrt where >> to look for this. Erik can most likely help you get started, if you have time >> to look at these issues. > > It *seems* to me that the compiler knows nothing of printing-related > stuff. That's correct :-) > However this is the first time I look at the compiler, so I > might have missed something. Also as far as I know most objects' > printing is implemented in Java, not in Lisp, so the compiler does not > take part in it. I'll investigate more deeply as soon as I have a > little time. Well, this is partially true: most built-in classes define their printing in Java, but all lisp-classes (including structures) define their printing lisp-side, just as any common lisp does: by implementing print-object. Even though I have implemented better printing for some condition classes, it's not completely clear to me which java methods are exactly called in which order to print object types which don't have a print-object method. It would be nice if you found out :-) Most print-object methods that ABCL comes with out-of-the-box are defined in print-object.lisp. So, basically, there are 2 strategies: implement a lisp-side print-object method which does what you want; it can use *print-readably* to determine the type of output it should generate; or maybe *print-pretty* (since Java-Object isn't readable anyway). The other strategy would be to find out where printing of built-in objects is defined and to change the way that works. HTH, Erik. |