~ chicken-core (master) adb25d7f8ce0a0a28fefb99767a39c6d1218386c


commit adb25d7f8ce0a0a28fefb99767a39c6d1218386c
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sat Jan 31 14:55:12 2026 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sat Jan 31 14:55:12 2026 +0100

    Added export-all library declaration

diff --git a/NEWS b/NEWS
index 56904cb3..81824612 100644
--- a/NEWS
+++ b/NEWS
@@ -75,6 +75,8 @@
     has been added.
   - Added `include-path' to (chicken platform) module.
   - Added `number-vector-data' to (chicken memory representation) module.
+  - `define-library' has been extended to support the `export-all'
+    specification.
   - The platform-identifier "mingw32" has been renamed to "mingw".
   - Library procedures that return paths now always convert them to
     contain forward slashes, 'make-pathname' always uses "/" for path
diff --git a/expand.scm b/expand.scm
index 32a415dd..c39c9c04 100644
--- a/expand.scm
+++ b/expand.scm
@@ -1253,9 +1253,10 @@
             (name (cadr x))
             (real-name (library-id name))
             (decls (cddr x))
+            (all #f)
             (dummy (register-r7rs-module real-name)))
        (define (parse-exports specs)
-	 (map (lambda (spec)
+         (map (lambda (spec)
                 (cond ((and (list? spec)
                             (= 3 (length spec))
                             (eq? 'rename (car spec)))
@@ -1310,6 +1311,10 @@
                    (##sys#check-syntax 'export spec '(_ . #(_ 0)))
                    `(##core#begin ,@(parse-exports (cdr spec))
                                   ,(parse-decls more)))
+                  ((export-all)
+                   (##sys#check-syntax 'export-all spec '(_))
+                   (set! all #t)
+                   (parse-decls more))
                   ((import)
                    (##sys#check-syntax 'import spec '(_ . #(_ 0)))
                    `(##core#begin ,(parse-imports (cdr spec))
@@ -1339,16 +1344,19 @@
                                   ,(parse-decls more)))
                   (else (fail spec)))))
                 (else (fail (car decls)))))
-       `(##core#module ,real-name ((,dummy))
-	 ;; gruesome hack: we add a dummy export for adding indirect exports
-	 (##core#define-syntax ,dummy
-	  (##sys#er-transformer (##core#lambda (x r c) (##core#undefined))))
-	 ;; Set up an R7RS environment for the module's body.
-	 (import-for-syntax (only scheme.base ,@implicit-r7rs-library-bindings))
-	 (import (only scheme.base ,@implicit-r7rs-library-bindings)
-            (only chicken.module export/rename))
-	 ;; Now process all toplevel library declarations
-	 ,(parse-decls decls))))))
+       (let ((pd (parse-decls decls)))
+         `(##core#module ,real-name ,(if all #t `((,dummy)))
+           ;; gruesome hack: we add a dummy export for adding indirect exports
+           ,@(if all
+                 '()
+                 `((##core#define-syntax ,dummy
+                    (##sys#er-transformer (##core#lambda (x r c) (##core#undefined))))))
+           ;; Set up an R7RS environment for the module's body.
+           (import-for-syntax (only scheme.base ,@implicit-r7rs-library-bindings))
+           (import (only scheme.base ,@implicit-r7rs-library-bindings)
+                   (only chicken.module export/rename))
+           ;; Now process all toplevel library declarations
+           ,pd))))))
 
 (##sys#extend-macro-environment
  'export '()
diff --git a/manual/Module (scheme base) b/manual/Module (scheme base)
index a71f5620..3b7260ce 100644
--- a/manual/Module (scheme base)	
+++ b/manual/Module (scheme base)	
@@ -1619,6 +1619,8 @@ A <library declaration> is any of:
 
 *   {{(export <export spec> ...)}}
 
+*   {{(export-all)}}
+
 *   {{(import <import set> ...)}}
 
 *   {{(begin <command or definition> ...)}}
@@ -1646,6 +1648,10 @@ binding defined within or imported into the library and named by <identifier
 [1]> in each {{(<identifier[1]> <identifier[2]>)}} pairing, using <identifier[2]>
 as the external name.
 
+As an extension to R7RS, CHICKEN allows the {{(export-all)}} specifier,
+which exports all defined entities to be visible when importing the
+library.
+
 An import declaration provides a way to import the identifiers exported by
 another library.
 
Trap