unofficial mirror of 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <>
To: guile-devel <>
Subject: scheme printer in scheme
Date: Sat, 14 May 2022 00:58:35 +0200	[thread overview]
Message-ID: <> (raw)

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


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 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     )
   (flags      )
   (values   )
   (pointer   )
   (frame    )
   (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


(use-modules (ice-9 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 --]

                 reply	other threads:[~2022-05-13 22:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \
    --subject='Re: scheme printer in scheme' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).