summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-03-28 21:27:11 +0200
committerAndy Wingo <wingo@pobox.com>2017-03-28 21:27:11 +0200
commitce934bcd43654d7370767d8d399625d1d066f8b3 (patch)
tree24a67a2256b5514da4b5e3198b8d2b9ee5d402fd /module
parenta42bfae65f445178d3608433356ce132d1e7369e (diff)
Add allow-legacy-syntax-objects? parameter
* module/ice-9/psyntax.scm (syntax?): Only recognize legacy syntax objects if the new allow-legacy-syntax-objects? parameter is true. * module/ice-9/boot-9.scm (allow-legacy-syntax-objects?): New parameter. * doc/ref/api-macros.texi (Syntax Transformer Helpers): Document the horrible situation with legacy syntax objects. * NEWS: Add entry.
Diffstat (limited to 'module')
-rw-r--r--module/ice-9/boot-9.scm9
-rw-r--r--module/ice-9/psyntax.scm3
2 files changed, 10 insertions, 2 deletions
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index be890fa45..a70cd11ef 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -299,6 +299,9 @@ This is handy for tracing function calls, e.g.:
(define (absolute-file-name? file-name) #t)
(define (open-input-file str) (open-file str "r"))
+;; Temporary definition; replaced by a parameter later.
+(define (allow-legacy-syntax-objects?) #f)
+
;;; {and-map and or-map}
;;;
;;; (and-map fn lst) is like (and (fn (car lst)) (fn (cadr lst)) (fn...) ...)
@@ -1423,11 +1426,15 @@ CONV is not applied to the initial value."
;;; Once parameters have booted, define the default prompt tag as being
-;;; a parameter.
+;;; a parameter, and make allow-legacy-syntax-objects? a parameter.
;;;
(set! default-prompt-tag (make-parameter (default-prompt-tag)))
+;; Because code compiled with Guile 2.2.0 embeds legacy syntax objects
+;; into its compiled macros, we have to default to true, sadly.
+(set! allow-legacy-syntax-objects? (make-parameter #t))
+
;;; {Languages}
diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm
index a45e2a6cc..5696c4642 100644
--- a/module/ice-9/psyntax.scm
+++ b/module/ice-9/psyntax.scm
@@ -473,7 +473,8 @@
(define (syntax-object? x)
(or (syntax? x)
- (and (vector? x)
+ (and (allow-legacy-syntax-objects?)
+ (vector? x)
(= (vector-length x) 4)
(eqv? (vector-ref x 0) 'syntax-object))))
(define (make-syntax-object expression wrap module)