On Sat, Oct 14, 2017 at 09:59:41PM +0200, Peter Bex wrote:
> 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.

OK, now I know for sure why we didn't do that before: it causes a panic..
This has something to do with the ordering of the requirements and what
they define in which order.  So, I've enhanced the comment a bit to
explain and removed the extra requirement in this new patch.

Cheers,
Peter
From 8810183cb093fa53ba467d8ee01b9e30f47d1dd8 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.

It also adds a more descriptive comment as to why we don't require the
"eval" unit as well.
---
 eval.scm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/eval.scm b/eval.scm
index 10162865..87b64957 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))
+  ;; The "scheme"/"rnrs" requirements are not totally correct, they
+  ;; all need "eval" as well, but that creates a cyclic dependency
+  ;; between eval and library, causing a segfault.
+  '((scheme . (##core#require library))
+    ;; r5rs can be skipped, it is defined as an alias for "scheme"
+    (r4rs . (##core#require library))
+    ;; Without an entry for *-null, we'd try to "load" an extension
+    (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