Downgrading error from changset 0151ce9ef063 to a warning, to allow raw (import (meta)), as used by e.g. (chibi modules).

This commit is contained in:
Alex Shinn 2013-01-03 23:59:24 +09:00
parent b42379539d
commit bd059d8fda

View file

@ -71,14 +71,14 @@
(string->symbol (substring bs (string-length as)))
b)))
;; (define (warn msg . args)
;; (display msg (current-error-port))
;; (display ":" (current-error-port))
;; (for-each (lambda (a)
;; (display " " (current-error-port))
;; (write a (current-error-port)))
;; args)
;; (newline (current-error-port)))
(define (warn msg . args)
(display msg (current-error-port))
(display ":" (current-error-port))
(for-each (lambda (a)
(display " " (current-error-port))
(write a (current-error-port)))
args)
(newline (current-error-port)))
(define (to-id id) (if (pair? id) (car id) id))
(define (from-id id) (if (pair? id) (cdr id) id))
@ -217,6 +217,14 @@
(_if (rename 'if))
(_cond (rename 'cond))
(_set! (rename 'set!)))
;; Check for suspicious defines.
(for-each
(lambda (x)
(if (and (pair? x) (memq (strip-syntactic-closures (car x))
'(define define-syntax)))
(warn "suspicious use of define in library declarations - did you forget to wrap it in begin?" x)))
(cdr expr))
;; Generate the library wrapper.
`(,_let ((,tmp ,this-module))
(,_define (rewrite-export x)
(,_if (pair? x)
@ -300,8 +308,3 @@
(cons '(srfi 0) (make-module (list 'cond-expand)
(current-environment)
(list (list 'export 'cond-expand))))))
(define-syntax define
(er-macro-transformer
(lambda (expr rename compare)
(error "invalid use of define in library declarations - did you forget to wrap it in begin?" expr))))