mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-12 15:37:35 +02:00
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:
parent
b42379539d
commit
bd059d8fda
1 changed files with 16 additions and 13 deletions
29
lib/meta.scm
29
lib/meta.scm
|
@ -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))))
|
||||
|
|
Loading…
Add table
Reference in a new issue