unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: guile-devel <guile-devel@gnu.org>
Subject: scheme printer in scheme
Date: Sat, 14 May 2022 00:58:35 +0200	[thread overview]
Message-ID: <CAGua6m3oSuFz-wHfT_p5fARV6rWW3bZPrt-BcH90g4esVddq7Q@mail.gmail.com> (raw)

[-- 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 --]

                 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=CAGua6m3oSuFz-wHfT_p5fARV6rWW3bZPrt-BcH90g4esVddq7Q@mail.gmail.com \
    --to=stefan.itampe@gmail.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).