Rework show API
Have you considered modifying the generic function showto take a stream to print to instead of returning strings?
Hadn't, no. It doesn't sound like it would be hard to implement. I'm assuming this makes some common idiom easier?
I'm assuming this makes some common idiom easier?
Not really, just that using streams to delegate rendering to sub-components is less clunky and generates less intermediate garbage as there is no need to concatenate the strings of sub-components (fields in this case).
So, in order to implement this, it looks like we'd need to
- Introduce a new argument to
show(the stream to be accepted) - Modify
html-to-strandhtml-to-stoutmacros to take their streams as arguments - Pass the
showargument to the output macro internally - Modify
define-showappropriately to handle the additional argument - Modify calls to
showinshow-formlet
I was thinking that show could be similar to print-object, except that it doesn't have to print unreadable objects between #< and >. In retrospect that is not the best choice for formlets as its API takes values and errors as arguments, adding a stream optional argument would be clunky. Also cl-who, unlike spinneret, doesn't export a special-variable that points to the stream it uses to write.