Hi!
I have managed to code a printer in scheme that is suspendable e.g. no jumping back and forth between scheme and C unless you use custom old port p printers or smob printers. This system also works nicely with a soft port construction I have that is completely written in scheme. So when one using the soft-suspendable-ports discussed in
http://itampe.com/suspendable-soft-ports.html it all works as well for format, display and write. As this is a pure scheme library solution there is no C interface that takes advantage of this system with more
than that one trampolines into scheme and use the scheme write,display and format. This is a proof of concept and not finished yet although more advanced objects like smob and ports with custom printers works as it should. Internals from the C implementation are used so older versions of guile may be buggy. The simple complex objects like struct and classes is a bit easier to maintain as their custom printers is scheme printers.
objects not handled:
(array )
(bitvector)
(flags )
(stringbuf)
(values )
(program)
(pointer )
(weak-set)
(weak-table)
(dynamic-state)
(frame )
(atomic-box)
(cont )
(wvect )
I do not expect any problems with those compared to what objects are already implemented.
Speedwise nothing is optimized. After a working module is finished we can work on speeding things up like a lookup-table for the tc7 dispatch and so on.
Usage:
(use-modules (ice-9 soft-suspendable-ports))
(install-soft-suspendable-ports!)
and you are ready to go with the repl now directly using the scheme printer instead of the C based printer. Likwise format in the shell will now use the scheme based printer.
Happy hacking