From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel Subject: scheme printer in scheme Date: Sat, 14 May 2022 00:58:35 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000ee77b105deec9d78" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26243"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat May 14 00:59:29 2022 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1npeFs-0006fw-CP for guile-devel@m.gmane-mx.org; Sat, 14 May 2022 00:59:28 +0200 Original-Received: from localhost ([::1]:37324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npeFq-0003hX-S9 for guile-devel@m.gmane-mx.org; Fri, 13 May 2022 18:59:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npeFI-0003hA-HJ for guile-devel@gnu.org; Fri, 13 May 2022 18:58:52 -0400 Original-Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:55238) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npeFF-0004z6-AW for guile-devel@gnu.org; Fri, 13 May 2022 18:58:50 -0400 Original-Received: by mail-pj1-x102f.google.com with SMTP id fv2so9262493pjb.4 for ; Fri, 13 May 2022 15:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=3Sy7oQUCt2yfK9Ha9PbmaaGwaGy17HoNnjormv7A0Hk=; b=AqY35lUFxuT513our3sfRwg1Up3d8aCSLIqTp2z/v2qh/PiUgPYUhwtfm9nr2zMbA9 GSur+ld2XeVwWFl+VygP2GoDbPbnswZw4aFR8e4wvm4XlPd5CQHpEO7J9dclA56U6myl T9jZuGzth0CH2o9JQDFcqDpzQmRbiJdcPFxiwRH3HhqEWsD2kiHSjl9NvoSpjaagLkpQ qYUaJfPE3g0QSDpDTqXJTN8hX19jrM1vVspwxpDuVLdZy+1ywCx8DQcgTZZ9OhssoYn7 MgYnfajUlG6rYmBVpydwAb90UWJt98DgQdvWEkygH7VUx4jdNtqhzC7/LrRB0HvXOAdO hPFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=3Sy7oQUCt2yfK9Ha9PbmaaGwaGy17HoNnjormv7A0Hk=; b=zocD34XPDP43GDL5Xs/o7vXl8di88kPAh208VIdHt/Dt00giG+iUyzOOzTTlPRY1BE kklCMA5oyt3yuAWOPylohxJprKUclQ+jP22eDUmVJQAW2lU7ndo6wLkAwt6k/y8scOnR A9ezM5ZBvh18zrougTPi565oT9z1ZfV6c7h3pNI3xnxka/s612RylTkl7dgAq7+IKQR5 RPHnttGOr90DJ50qTH/0xAlIsHXfRupxAducwutfWBzqKgaP4XYVaY+Ce7G7T8h79FSt hRnPxRVaxXZzpgN2O2E63qPsYN3p03Il/2PMuTie1NZsx/+a/RZGOj5g3fQpnoVsH6kC 5xkw== X-Gm-Message-State: AOAM5303cOZ4Jc5GTfj2maFx0M0/hg5Ole7aVdIh87vFfSVSn7PeY4wU cKqMXljhjC5vtQatOeKcYIwdxstCc5NIFhns5yMFQYp7HRU= X-Google-Smtp-Source: ABdhPJyJbwDBIiGImvr7y2Q914mG8X7rt18iszO4+JyeRFGDC4z9VQCW0QAFXavONdNNmheK9GnIhssVf5JCbwYggug= X-Received: by 2002:a17:902:ec88:b0:15e:c17d:b092 with SMTP id x8-20020a170902ec8800b0015ec17db092mr6684381plg.88.1652482726851; Fri, 13 May 2022 15:58:46 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=stefan.itampe@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:21212 Archived-At: --000000000000ee77b105deec9d78 Content-Type: text/plain; charset="UTF-8" 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 --000000000000ee77b105deec9d78 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

I have managed to code a printer in= scheme that is suspendable e.g. no jumping back and forth between scheme a= nd C unless you use custom old port p printers=C2=A0or smob printers. This = system also works nicely with a soft port construction I have that is compl= etely written in scheme. So when one using the soft-suspendable-ports discu= ssed in=C2=A0http= ://itampe.com/suspendable-soft-ports.html it all works as well for form= at, display and write. As this is a pure scheme library solution there is n= o C interface that takes advantage of this system with more=C2=A0
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 adva= nced objects like=C2=A0smob and ports with custom printers works as it shou= ld. 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.
<= br>
objects not handled:
=C2=A0 =C2=A0(array=C2=A0 =C2= =A0 =C2=A0)
=C2=A0 =C2=A0(bitvector)
=C2=A0 =C2=A0(flags=C2=A0 =C2=A0= =C2=A0 )
=C2=A0 =C2=A0(stringbuf)
=C2=A0 =C2=A0(values=C2=A0 =C2=A0)=
=C2=A0 =C2=A0(program)
=C2=A0 =C2=A0(pointer=C2=A0 =C2=A0) =C2=A0 =C2=A0 =C2=A0(weak-set)
=C2=A0 =C2=A0(weak-table)
=C2=A0 =C2=A0(dyn= amic-state)
=C2=A0 =C2=A0(frame=C2=A0 =C2=A0 ) =C2=A0 =C2=A0 =C2=A0
= =C2=A0 =C2=A0(atomic-box)
=C2=A0 =C2=A0(cont=C2=A0 =C2=A0 =C2=A0 ) =C2= =A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0(wvect=C2=A0 =C2=A0 )

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 t= hings up like a lookup-table=C2=A0for the tc7 dispatch and so on.

Usage:

(use-modules (ice-9 soft-su= spendable-ports))
(install-soft-suspendable-ports!)
=

and you are ready to go with the repl now directly usin= g the scheme=C2=A0printer instead of the C based printer. Likwise=C2=A0form= at in the shell will now use the scheme based printer.

=
Happy hacking

--000000000000ee77b105deec9d78--