[PATCHES] Use a better SRFI-64 implementation.

2021-05-10 Thread Taylan Kammer
Hi Guile devs,

I've noticed there have been a couple bug reports about SRFI-64
recently.  Guile uses the reference implementation of SRFI-64 which has
really terrible readability, doesn't conform to its own standard, and
was revealed to have a number of bugs over the years.

I've attached two patches, the first of which replaces the SRFI-64
implementation shipped with Guile to the one I wrote as part of the R7RS
Scheme SRFIs project,[0] and the second patch adds a few tests to the
SRFI-64 meta test suite.

This implementation of SRFI-64 offers the following improvements:

- Much better readability through a modular design, modernized Scheme
code, better identifier names, and otherwise prettified code

- Output about executed tests in a format familiar to GNU users

- Improved expand-time performance for large test suites

- Fully conforms to the SRFI-64 specification

- Offers a small number of extensions

See the notes about SRFI-64 in the README of the Scheme SRFIs project[0]
for the most important differences from the reference implementation,
like the way it conforms to the spec where the reference implementation
doesn't, and the extensions mentioned above.


I had already proposed such a patch a number of years ago, but it was
rejected on the grounds that the upstream implementation is probably
better tested.  I think the fact that there have been grave bugs in the
implementation that remained uncovered in ~15 years evidences that this
is not a valid reason.  I believe that the over-complicated way the code
is written masks bugs and discourages people from improving the code.


What do you think?  IMO this would be a clear improvement.


[0] https://github.com/TaylanUB/scheme-srfis
From fa23f90fe3e516e57e6f1ddae5517d7170c62f44 Mon Sep 17 00:00:00 2001
From: Taylan Kammer 
Date: Mon, 10 May 2021 15:23:17 +0200
Subject: [PATCH 1/2] Use a different SRFI-64 implementation.

* module/srfi/srfi-64.scm: Add imports and other boilerplate for new
  implementation.
* module/srfi/srfi-64/execution.body.scm: New file.
* module/srfi/srfi-64/source-info.body.scm: New file.
* module/srfi/srfi-64/test-runner-simple.body.scm: New file.
* module/srfi/srfi-64/test-runner.body.scm: New file.
* module/srfi/srfi-64/testing.scm: Deleted.
* module/Makefile.am (srfi-64.go, NOCOMP_SOURCES): Change accordingly.
---
 module/Makefile.am|  11 +-
 module/srfi/srfi-64.scm   |  14 +-
 module/srfi/srfi-64/execution.body.scm| 426 ++
 module/srfi/srfi-64/source-info.body.scm  |  88 
 .../srfi/srfi-64/test-runner-simple.body.scm  | 168 +++
 module/srfi/srfi-64/test-runner.body.scm  | 165 +++
 6 files changed, 868 insertions(+), 4 deletions(-)
 create mode 100644 module/srfi/srfi-64/execution.body.scm
 create mode 100644 module/srfi/srfi-64/source-info.body.scm
 create mode 100644 module/srfi/srfi-64/test-runner-simple.body.scm
 create mode 100644 module/srfi/srfi-64/test-runner.body.scm

diff --git a/module/Makefile.am b/module/Makefile.am
index 41b77095b..e1c5267e7 100644
--- a/module/Makefile.am
+++ b/module/Makefile.am
@@ -29,7 +29,11 @@ $(VM_TARGETS): $(top_builddir)/libguile/vm-operations.h
 
 ice-9/boot-9.go: ice-9/boot-9.scm ice-9/quasisyntax.scm 
ice-9/r6rs-libraries.scm ice-9/r7rs-libraries.scm ice-9/read.scm
 ice-9/match.go: ice-9/match.scm ice-9/match.upstream.scm
-srfi/srfi-64.go: srfi/srfi-64.scm srfi/srfi-64/testing.scm
+srfi/srfi-64.go: srfi/srfi-64.scm  \
+  srfi/srfi-64/execution.body.scm  \
+  srfi/srfi-64/source-info.body.scm\
+  srfi/srfi-64/test-runner-simple.body.scm \
+  srfi/srfi-64/test-runner.body.scm
 $(nobase_ccache_DATA): ../bootstrap/ice-9/eval.go
 
 # Keep this rule in sync with that in `am/guilec'.
@@ -403,7 +407,10 @@ NOCOMP_SOURCES =   \
   ice-9/r7rs-libraries.scm \
   ice-9/quasisyntax.scm\
   srfi/srfi-42/ec.scm  \
-  srfi/srfi-64/testing.scm \
+  srfi/srfi-64/execution.body.scm  \
+  srfi/srfi-64/source-info.body.scm\
+  srfi/srfi-64/test-runner-simple.body.scm \
+  srfi/srfi-64/test-runner.body.scm\
   srfi/srfi-67/compare.scm \
   system/base/lalr.upstream.scm\
   system/repl/describe.scm \
diff --git a/module/srfi/srfi-64.scm b/module/srfi/srfi-64.scm
index 925726f5c..a8cb08874 100644
--- a/module/srfi/srfi-64.scm
+++ b/module/srfi/srfi-64.scm
@@ -24,9 +24,9 @@
test-match-nth test-match-all test-match-any test-match-name
test-skip test-expect-fail test-read-eval-string
test-runner-group-path test-group test-group-with-cleanup
+   test-exit
test-result-ref test-result-set! test-result-clear test-result-remove
test-result-kind test-passed?
-   test-log-to-file
test-runner? test-runner-reset test-runner-null
test-runner-si

[PATCH] Improve support for R6/R7 SRFI module name formats.

2021-05-10 Thread Taylan Kammer
Hi Guile devs,

This patch improves Guile's support for SRFI module names in the R6RS
and R7RS formats, i.e. (srfi :n) and (srfi n).


Copying from the commit message:

It was already possible to import an SRFI module by referencing it
as (srfi :n) which is automatically translated to (srfi srfi-n), but
this conversion was only done during import.  After this change, it's
also possible to define a library as (srfi :n) which is automatically
translated to (srfi srfi-n) during definition.

It was not possible at all to define or import SRFI module names in the
R7RS format, (srfi n), where n is a non-negative exact integer.  It is
now possible both to define and import them as such, realized through
the same kind of conversion to a canonical (srfi srfi-n) name.


The patch is attached as a MIME attachment in git format-patch format.


Note, by the way, that there was already a little bit of code in
module/ice-9/r6rs-libraries.scm to support module names like (srfi n),
but it didn't work in practice because syntax-case guards in all the
"entry points" barred the possibility of using that format.


Another note: r6rs-libraries.scm uses both 'identifier?' and the form
'sym?' which is defined as '(symbol? (syntax->datum x))'.  It's unclear
to me what the difference is and I hope my use of 'sym?' is correct.


Relevant bug reports:

- https://bugs.gnu.org/39601 (fixed)

- https://bugs.gnu.org/40371 (partly fixed)


Taylan
From b607613028f8f6764c03c1d7917434242ee32191 Mon Sep 17 00:00:00 2001
From: Taylan Kammer 
Date: Mon, 10 May 2021 18:12:34 +0200
Subject: [PATCH] Improve support for R6/R7 SRFI module name formats.

Fixes .

Partly fixes .

It was already possible to import an SRFI module by referencing it
as (srfi :n) which is automatically translated to (srfi srfi-n), but
this conversion was only done during import.  After this change, it's
also possible to define a library as (srfi :n) which is automatically
translated to (srfi srfi-n) during definition.

It was not possible at all to define or import SRFI module names in the
R7RS format, (srfi n), where n is a non-negative exact integer.  It is
now possible both to define and import them as such, realized through
the same kind of conversion to a canonical (srfi srfi-n) name.

* module/ice-9/r6rs-libraries.scm: Numerous changes.
---
 module/ice-9/r6rs-libraries.scm | 84 -
 1 file changed, 62 insertions(+), 22 deletions(-)

diff --git a/module/ice-9/r6rs-libraries.scm b/module/ice-9/r6rs-libraries.scm
index c6ba6a496..33dcbde22 100644
--- a/module/ice-9/r6rs-libraries.scm
+++ b/module/ice-9/r6rs-libraries.scm
@@ -20,6 +20,49 @@
 ;; This file is included from boot-9.scm and assumes the existence of (and 
 ;; expands into) procedures and syntactic forms defined therein.
 
+(define (sym? stx)
+  (symbol? (syntax->datum stx)))
+
+(define (n? stx)
+  (let ((n (syntax->datum stx)))
+(and (exact-integer? n)
+ (not (negative? n)
+
+(define (colon-n? x)
+  (let ((sym (syntax->datum x)))
+(and (symbol? sym)
+ (let ((str (symbol->string sym)))
+   (and (string-prefix? ":" str)
+(let ((num (string->number (substring str 1
+  (and (exact-integer? num)
+   (not (negative? num)
+
+(define (srfi-name? stx)
+  (syntax-case stx (srfi)
+((srfi n rest ...)
+ (and (and-map sym? #'(rest ...))
+  (or (n? #'n)
+  (colon-n? #'n
+(_ #f)))
+
+(define (module-name? stx)
+  (or (srfi-name? stx)
+  (syntax-case stx ()
+((name name* ...)
+ (and-map sym? #'(name name* ...)))
+(_ #f
+
+(define (make-srfi-n context n)
+  (datum->syntax
+   context
+   (string->symbol
+(string-append
+ "srfi-"
+ (let ((n (syntax->datum n)))
+   (if (symbol? n)
+   (substring (symbol->string n) 1)
+   (number->string n)))
+
 (define (resolve-r6rs-interface import-spec)
   (define (make-custom-interface mod)
 (let ((iface (make-module)))
@@ -37,27 +80,13 @@
 (for-each (lambda (mod)
 (module-for-each f mod))
   (module-and-uses mod)))
-  (define (sym? x) (symbol? (syntax->datum x)))
 
   (syntax-case import-spec (library only except prefix rename srfi)
 ;; (srfi :n ...) -> (srfi srfi-n ...)
 ;; (srfi n ...) -> (srfi srfi-n ...)
 ((library (srfi n rest ... (version ...)))
- (and (and-map sym? #'(srfi rest ...))
-  (or (and
-   (symbol? (syntax->datum #'n))
-   (let ((str (symbol->string (syntax->datum #'n
- (and (string-prefix? ":" str)
-  (and=> (string->number (substring str 1))
- exact-integer?
-  (exact-integer? (syntax->datum #'n
- (let ((srfi-n (string->symbol
-(string-append
- "srfi-"
- (le

Re: GNU Guile 3.0.7 released

2021-05-10 Thread Jérémy Korwin-Zmijowski
Yay! 

Thank you all for your work !

Jérémy
-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma 
brièveté.

GNU Guile 3.0.7 released

2021-05-10 Thread Andy Wingo
We are humbled to announce GNU Guile release 3.0.7, the latest in the
3.0 stable release series.

This is a fix-up release.  Compared to Guile 3.0.6, Guile 3.0.7 fixes a
number of bugs, many of which were introduced in the 3.0 series.

Compared to the previous stable series (2.2.x), Guile 3.0 adds support
for just-in-time native code generation, speeding up all Guile programs.
See the NEWS extract at the end of the mail for full details.


The Guile web page is located at http://gnu.org/software/guile/, and
among other things, it contains a copy of the Guile manual and pointers
to more resources.

Guile is an implementation of the Scheme programming language, packaged
for use in a wide variety of environments.  In addition to implementing
the R5RS, R6RS, and R7RS Scheme standards, Guile includes full access to
POSIX system calls, networking support, multiple threads, dynamic
linking, a foreign function call interface, powerful string processing,
and HTTP client and server implementations.

Guile can run interactively, as a script interpreter, and as a Scheme
compiler to VM bytecode.  It is also packaged as a library so that
applications can easily incorporate a complete Scheme interpreter/VM.
An application can use Guile as an extension language, a clean and
powerful configuration language, or as multi-purpose "glue" to connect
primitives provided by the application.  It is easy to call Scheme code
from C code and vice versa.  Applications can add new functions, data
types, control structures, and even syntax to Guile, to create a
domain-specific language tailored to the task at hand.

Guile 3.0.7 can be installed in parallel with Guile 2.2.x; see
http://www.gnu.org/software/guile/manual/html_node/Parallel-Installations.html.

A more detailed NEWS summary follows these details on how to get the
Guile sources.

Here are the compressed sources:
  http://ftp.gnu.org/gnu/guile/guile-3.0.7.tar.lz   (10MB)
  http://ftp.gnu.org/gnu/guile/guile-3.0.7.tar.xz   (13MB)
  http://ftp.gnu.org/gnu/guile/guile-3.0.7.tar.gz   (21MB)

Here are the GPG detached signatures[*]:
  http://ftp.gnu.org/gnu/guile/guile-3.0.7.tar.lz.sig
  http://ftp.gnu.org/gnu/guile/guile-3.0.7.tar.xz.sig
  http://ftp.gnu.org/gnu/guile/guile-3.0.7.tar.gz.sig

Use a mirror for higher download bandwidth:
  http://www.gnu.org/order/ftp.html

Here are the SHA256 checksums:

  f02166205ced31651d27bd037f947e199a442545ca73f913907c69469ddd7b54  
guile-3.0.7.tar.lz
  f57d86c70620271bfceb7a9be0c81744a033f08adc7ceba832c9917ab3e691b7  
guile-3.0.7.tar.xz
  c7935b7a29e42443f6a35d35cf20ffa7d028c399303f872cd1219598a83656ae  
guile-3.0.7.tar.gz

[*] Use a .sig file to verify that the corresponding file (without the
.sig suffix) is intact.  First, be sure to download both the .sig file
and the corresponding tarball.  Then, run a command like this:

  gpg --verify guile-3.0.7.tar.gz.sig

If that command fails because you don't have the required public key,
then run this command to import it:

  gpg --keyserver keys.gnupg.net --recv-keys 
4FD4D288D445934E0A14F9A5A8803732E4436885

and rerun the 'gpg --verify' command.

This release was bootstrapped with the following tools:
  Autoconf 2.71
  Automake 1.16.2
  Libtool 2.4.6
  Gnulib v0.1-4551-ga3a946f670
  Makeinfo 6.7

An extract from NEWS follows.


Changes in 3.0.7 (since 3.0.6)

* New interfaces and functionality

** More O_* POSIX constants are now defined in Scheme

Guile now defines constants such as `O_NOFOLLOW', `O_CLOEXEC',
`O_TMPFILE', and more on platforms that support them.  These may be
passed as arguments to procedures such as `open' and `open-fdes'.

* Bug fixes

** Fix bugs introduced in 3.0.6 with Scheme `read` re-write
** Fix deadlock after `primitive-fork' (#41948)
** Fix duplicates handlers for interfaces that use interfaces (#43025)
** Fix compile-psyntax.scm for (language tree-il canonicalize) removal
** Fix prompt compilation bug (#48098)
** Fix R7RS include-library-declarations, cond-expand (#40252)
** Fix --enable-mini-gmp on FreeBSD and other targets
** Fix excessive compile times for vectors >16k elements long
** Fix use of literal tree-il as source language (#45131)
** Fix SRFI-64 test-end to not remove globally-installed test runner