~ chicken-core (chicken-5) 54e9d7c65a979e21679650b6ccd102c456db5307


commit 54e9d7c65a979e21679650b6ccd102c456db5307
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Mon Jul 17 19:02:07 2017 +1200
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Mon Jul 17 19:02:07 2017 +1200

    Add compatibility shims for use of 'define-record-type' within core
    
    After 54b0d5ad, record type tags include a namespace prefix when defined
    within a module. However, when bootstrapping from an older version of
    CHICKEN, the compiler that's used to build the stage1 boot-chicken won't
    include these prefixes and the resulting chicken will bomb out with
    errors when building core. As a temporary workaround, we add a feature
    as an indicator of the new behaviour and revert to the old behaviour
    when it isn't registered.

diff --git a/chicken-syntax.scm b/chicken-syntax.scm
index fff681e4..c45f6c33 100644
--- a/chicken-syntax.scm
+++ b/chicken-syntax.scm
@@ -974,6 +974,9 @@
 	   (x (r 'x))
 	   (y (r 'y))
 	   (slotnames (map car slots)))
+      ;; TODO OBSOLETE remove after snapshot release
+      (unless (feature? #:namespaced-record-type-tags)
+	(set! tag plain-name))
       `(##core#begin
 	;; TODO: Maybe wrap this in an opaque object?
 	(,%define ,type-name (##core#quote ,tag))
diff --git a/support.scm b/support.scm
index 6f2ec807..1b4c9874 100644
--- a/support.scm
+++ b/support.scm
@@ -479,8 +479,13 @@
 (define-record-printer (node n out)
   (fprintf out "#<node ~a ~a>" (node-class n) (node-parameters n)))
 
-(define (make-node c p s)
-  (##sys#make-structure 'node c p s) ) ; this kludge is for allowing the inlined `make-node'
+;; this kludge is for allowing the inlined `make-node'
+(cond-expand
+  (namespaced-record-type-tags
+   (define (make-node c p s)
+     (##sys#make-structure 'chicken.compiler.support#node c p s)))
+  (else ; TODO OBSOLETE remove after snapshot release
+   (define (make-node c p s) (##sys#make-structure 'node c p s))))
 
 (define (varnode var) (make-node '##core#variable (list var) '()))
 (define (qnode const) (make-node 'quote (list const) '()))
diff --git a/tweaks.scm b/tweaks.scm
index d473dcfe..e7d94183 100644
--- a/tweaks.scm
+++ b/tweaks.scm
@@ -38,8 +38,16 @@
      (no-argc-checks)))
   (else))
 
-(define-inline (node? x) (##sys#structure? x 'node))
-(define-inline (make-node c p s) (##sys#make-structure 'node c p s))
+;; TODO OBSOLETE remove after snapshot release
+(register-feature! #:namespaced-record-type-tags)
+
+(cond-expand
+  (namespaced-record-type-tags
+   (define-inline (node? x) (##sys#structure? x 'chicken.compiler.support#node))
+   (define-inline (make-node c p s) (##sys#make-structure 'chicken.compiler.support#node c p s)))
+  (else ; TODO OBSOLETE remove after snapshot release
+   (define-inline (node? x) (##sys#structure? x 'node))
+   (define-inline (make-node c p s) (##sys#make-structure 'node c p s))))
 
 (cond-expand
   ((not debugbuild)
Trap