1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 05:50:26 +02:00

syntax-object->datum => syntax->datum, likewise datum->syntax

* module/ice-9/boot-9.scm (datum->syntax, syntax->datum): Rename from
  datum->syntax-object and syntax-object->datum, following r6rs. Change
  all callers. Reorder some of the other exports from psyntax.

* module/ice-9/psyntax.scm: Change datum->syntax and syntax->datum
  definitions and callers.

* module/ice-9/psyntax-pp.scm: Regenerated.

* module/oop/goops.scm (define-class-pre-definition): Update for changes.
This commit is contained in:
Andy Wingo 2009-04-26 20:56:24 +02:00
parent e4721dde31
commit 22225fc113
4 changed files with 42 additions and 41 deletions

View file

@ -187,12 +187,13 @@
(define syntax-violation #f) (define syntax-violation #f)
(define (annotation? x) #f) (define (annotation? x) #f)
(define bound-identifier=? #f) (define datum->syntax #f)
(define datum->syntax-object #f) (define syntax->datum #f)
(define free-identifier=? #f)
(define generate-temporaries #f)
(define identifier? #f) (define identifier? #f)
(define syntax-object->datum #f) (define generate-temporaries #f)
(define bound-identifier=? #f)
(define free-identifier=? #f)
(define andmap (define andmap
(lambda (f first . rest) (lambda (f first . rest)
@ -234,28 +235,28 @@
"Define a defmacro." "Define a defmacro."
(syntax-case x () (syntax-case x ()
((_ (macro . args) doc body1 body ...) ((_ (macro . args) doc body1 body ...)
(string? (syntax-object->datum (syntax doc))) (string? (syntax->datum (syntax doc)))
(syntax (define-macro macro doc (lambda args body1 body ...)))) (syntax (define-macro macro doc (lambda args body1 body ...))))
((_ (macro . args) body ...) ((_ (macro . args) body ...)
(syntax (define-macro macro #f (lambda args body ...)))) (syntax (define-macro macro #f (lambda args body ...))))
((_ macro doc transformer) ((_ macro doc transformer)
(or (string? (syntax-object->datum (syntax doc))) (or (string? (syntax->datum (syntax doc)))
(not (syntax-object->datum (syntax doc)))) (not (syntax->datum (syntax doc))))
(syntax (syntax
(define-syntax macro (define-syntax macro
(lambda (y) (lambda (y)
doc doc
(syntax-case y () (syntax-case y ()
((_ . args) ((_ . args)
(let ((v (syntax-object->datum (syntax args)))) (let ((v (syntax->datum (syntax args))))
(datum->syntax-object y (apply transformer v)))))))))))) (datum->syntax y (apply transformer v))))))))))))
(define-syntax defmacro (define-syntax defmacro
(lambda (x) (lambda (x)
"Define a defmacro, with the old lispy defun syntax." "Define a defmacro, with the old lispy defun syntax."
(syntax-case x () (syntax-case x ()
((_ macro args doc body1 body ...) ((_ macro args doc body1 body ...)
(string? (syntax-object->datum (syntax doc))) (string? (syntax->datum (syntax doc)))
(syntax (define-macro macro doc (lambda args body1 body ...)))) (syntax (define-macro macro doc (lambda args body1 body ...))))
((_ macro args body ...) ((_ macro args body ...)
(syntax (define-macro macro #f (lambda args body ...))))))) (syntax (define-macro macro #f (lambda args body ...)))))))

File diff suppressed because one or more lines are too long

View file

@ -49,7 +49,7 @@
;;; also documented in the R4RS and draft R5RS. ;;; also documented in the R4RS and draft R5RS.
;;; ;;;
;;; bound-identifier=? ;;; bound-identifier=?
;;; datum->syntax-object ;;; datum->syntax
;;; define-syntax ;;; define-syntax
;;; fluid-let-syntax ;;; fluid-let-syntax
;;; free-identifier=? ;;; free-identifier=?
@ -60,7 +60,7 @@
;;; letrec-syntax ;;; letrec-syntax
;;; syntax ;;; syntax
;;; syntax-case ;;; syntax-case
;;; syntax-object->datum ;;; syntax->datum
;;; syntax-rules ;;; syntax-rules
;;; with-syntax ;;; with-syntax
;;; ;;;
@ -209,7 +209,7 @@
;;; Objects with no standard print syntax, including objects containing ;;; Objects with no standard print syntax, including objects containing
;;; cycles and syntax object, are allowed in quoted data as long as they ;;; cycles and syntax object, are allowed in quoted data as long as they
;;; are contained within a syntax form or produced by datum->syntax-object. ;;; are contained within a syntax form or produced by datum->syntax.
;;; Such objects are never copied. ;;; Such objects are never copied.
;;; All identifiers that don't have macro definitions and are not bound ;;; All identifiers that don't have macro definitions and are not bound
@ -264,14 +264,14 @@
(lambda (x) (lambda (x)
(define construct-name (define construct-name
(lambda (template-identifier . args) (lambda (template-identifier . args)
(datum->syntax-object (datum->syntax
template-identifier template-identifier
(string->symbol (string->symbol
(apply string-append (apply string-append
(map (lambda (x) (map (lambda (x)
(if (string? x) (if (string? x)
x x
(symbol->string (syntax-object->datum x)))) (symbol->string (syntax->datum x))))
args)))))) args))))))
(syntax-case x () (syntax-case x ()
((_ (name id1 ...)) ((_ (name id1 ...))
@ -1351,7 +1351,7 @@
(lambda (e docstring c r w mod k) (lambda (e docstring c r w mod k)
(syntax-case c () (syntax-case c ()
((args doc e1 e2 ...) ((args doc e1 e2 ...)
(and (string? (syntax-object->datum (syntax doc))) (not docstring)) (and (string? (syntax->datum (syntax doc))) (not docstring))
(chi-lambda-clause e (syntax doc) (syntax (args e1 e2 ...)) r w mod k)) (chi-lambda-clause e (syntax doc) (syntax (args e1 e2 ...)) r w mod k))
(((id ...) e1 e2 ...) (((id ...) e1 e2 ...)
(let ((ids (syntax (id ...)))) (let ((ids (syntax (id ...))))
@ -1814,8 +1814,8 @@
(syntax-case e () (syntax-case e ()
((_ (mod ...) id) ((_ (mod ...) id)
(and (andmap id? (syntax (mod ...))) (id? (syntax id))) (and (andmap id? (syntax (mod ...))) (id? (syntax id)))
(values (syntax-object->datum (syntax id)) (values (syntax->datum (syntax id))
(syntax-object->datum (syntax->datum
(syntax (public mod ...)))))))) (syntax (public mod ...))))))))
(global-extend 'module-ref '@@ (global-extend 'module-ref '@@
@ -1823,8 +1823,8 @@
(syntax-case e () (syntax-case e ()
((_ (mod ...) id) ((_ (mod ...) id)
(and (andmap id? (syntax (mod ...))) (id? (syntax id))) (and (andmap id? (syntax (mod ...))) (id? (syntax id)))
(values (syntax-object->datum (syntax id)) (values (syntax->datum (syntax id))
(syntax-object->datum (syntax->datum
(syntax (private mod ...)))))))) (syntax (private mod ...))))))))
(global-extend 'begin 'begin '()) (global-extend 'begin 'begin '())
@ -2004,11 +2004,11 @@
(lambda (x) (lambda (x)
(nonsymbol-id? x))) (nonsymbol-id? x)))
(set! datum->syntax-object (set! datum->syntax
(lambda (id datum) (lambda (id datum)
(make-syntax-object datum (syntax-object-wrap id) #f))) (make-syntax-object datum (syntax-object-wrap id) #f)))
(set! syntax-object->datum (set! syntax->datum
; accepts any object, since syntax objects may consist partially ; accepts any object, since syntax objects may consist partially
; or entirely of unwrapped, nonsymbolic data ; or entirely of unwrapped, nonsymbolic data
(lambda (x) (lambda (x)
@ -2292,11 +2292,11 @@
(let f ((x (read p))) (let f ((x (read p)))
(if (eof-object? x) (if (eof-object? x)
(begin (close-input-port p) '()) (begin (close-input-port p) '())
(cons (datum->syntax-object k x) (cons (datum->syntax k x)
(f (read p)))))))) (f (read p))))))))
(syntax-case x () (syntax-case x ()
((k filename) ((k filename)
(let ((fn (syntax-object->datum (syntax filename)))) (let ((fn (syntax->datum (syntax filename))))
(with-syntax (((exp ...) (read-file fn (syntax k)))) (with-syntax (((exp ...) (read-file fn (syntax k))))
(syntax (begin exp ...)))))))) (syntax (begin exp ...))))))))
@ -2306,7 +2306,7 @@
((_ e) ((_ e)
(error 'unquote (error 'unquote
"expression ,~s not valid outside of quasiquote" "expression ,~s not valid outside of quasiquote"
(syntax-object->datum (syntax e))))))) (syntax->datum (syntax e)))))))
(define-syntax unquote-splicing (define-syntax unquote-splicing
(lambda (x) (lambda (x)
@ -2314,7 +2314,7 @@
((_ e) ((_ e)
(error 'unquote-splicing (error 'unquote-splicing
"expression ,@~s not valid outside of quasiquote" "expression ,@~s not valid outside of quasiquote"
(syntax-object->datum (syntax e))))))) (syntax->datum (syntax e)))))))
(define-syntax case (define-syntax case
(lambda (x) (lambda (x)

View file

@ -241,8 +241,8 @@
(lambda (x) (lambda (x)
(syntax-case x () (syntax-case x ()
((_ (k arg rest ...) out ...) ((_ (k arg rest ...) out ...)
(keyword? (syntax-object->datum (syntax k))) (keyword? (syntax->datum (syntax k)))
(case (syntax-object->datum (syntax k)) (case (syntax->datum (syntax k))
((#:getter #:setter) ((#:getter #:setter)
(syntax (syntax
(define-class-pre-definition (rest ...) (define-class-pre-definition (rest ...)
@ -277,7 +277,7 @@
((_ () out ...) ((_ () out ...)
(syntax (begin out ...))) (syntax (begin out ...)))
((_ (slot rest ...) out ...) ((_ (slot rest ...) out ...)
(keyword? (syntax-object->datum (syntax slot))) (keyword? (syntax->datum (syntax slot)))
(syntax (begin out ...))) (syntax (begin out ...)))
((_ (slot rest ...) out ...) ((_ (slot rest ...) out ...)
(identifier? (syntax slot)) (identifier? (syntax slot))