Hi all,

I was messing around trying to figure out how to make a working
definition of the "scheme" module without referring to itself,
but found out that r4rs, r4rs-null, and r5rs-null don't work
anymore:

#;1> (module foo (x) (import r4rs) (define x 1))

Error: (require) cannot load extension: r4rs


Interestingly, in CHICKEN 4 this still works for <reasons I was
unable to determine>.

The "r5rs" module does work because it's resolved as "scheme",
which has an entry in core-unit-requirements.

The attached patch fixes this and also takes care of the "XXX" comment
that tells us that "eval" is a requirement of anything that uses one of
the scheme standard modules.  I'm not 100% convinced this is the right
thing to do, because this would make it impossible to create a custom
built binary that excludes "eval" and friends.

Finally, should we get rid of r4rs-null and r5rs-null?  They're not
documented and they're *not* the same as the first-class
(null-environment), from what I can tell.

Cheers,
Peter
From 8b7eb9a077bd737a21dc80b3f96b0791a19c859c Mon Sep 17 00:00:00 2001
From: Peter Bex <[email protected]>
Date: Sat, 14 Oct 2017 21:47:54 +0200
Subject: [PATCH] Unbreak rnrs modules

Somehow we managed to break (import r4rs), (import r4rs-null) and
(import r5rs-null).  This unbreaks imports of these builtin modules.
---
 eval.scm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/eval.scm b/eval.scm
index 10162865..57fc212f 100644
--- a/eval.scm
+++ b/eval.scm
@@ -895,8 +895,15 @@
 (define-foreign-variable uses-soname? bool "C_USES_SONAME")
 
 (define-constant core-unit-requirements
-  '((scheme ; XXX not totally correct, also needs eval
-     . (##core#require library))
+  '((scheme . (##core#begin
+	       (##core#require library)
+	       (##core#require eval)))
+    ;; r5rs can be skipped, it is defined as an alias for "scheme"
+    (r4rs . (##core#begin
+	       (##core#require library)
+	       (##core#require eval)))
+    (r4rs-null . (##core#begin))
+    (r5rs-null . (##core#begin))
     (chicken.foreign
      . (##core#require-for-syntax chicken-ffi-syntax))
     (chicken.condition
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to