[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] Convention for multi-line pretty-printed output
From: |
Jose E. Marchesi |
Subject: |
Re: [RFC] Convention for multi-line pretty-printed output |
Date: |
Sun, 03 May 2020 22:49:47 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> All you have to do is to add a method called _print to your struct type,
> that should get no arguments and should return no value.
Hm, speaking of this: wouldn't it be handy to have the _print function
return the formatted string instead of printing it directly? This could
be useful for (probably) a number of things, but of the top of my head I
guess it could be useful for nested structs (i.e. a struct Foo has a
member struct Bar, Bar already has a pretty printer, and then Foo could
pretty print itself and potentially mess with Bar's output or just
wouldn't have to call printf multiple times).
I thought about that. Returning a string would have the advantage of
pvm_print_val to do stuff with the string, such as indentation.
However, the big problem is that currently Poke strings are not
"enriched", i.e. it is not possible to convey styling/formatting
information in a string.
Maybe this would be a good motivation to support text properties in
strings...