unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* scheme printer in scheme
@ 2022-05-13 22:58 Stefan Israelsson Tampe
  0 siblings, 0 replies; only message in thread
From: Stefan Israelsson Tampe @ 2022-05-13 22:58 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1750 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2199 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-13 22:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 22:58 scheme printer in scheme Stefan Israelsson Tampe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).