mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-10 22:47:33 +02:00
implementing environment
This commit is contained in:
parent
ef14dac179
commit
0bc1e27224
2 changed files with 12 additions and 2 deletions
12
lib/meta.scm
12
lib/meta.scm
|
@ -134,6 +134,16 @@
|
||||||
(module-meta-data mod))
|
(module-meta-data mod))
|
||||||
env))
|
env))
|
||||||
|
|
||||||
|
(define (environment . ls)
|
||||||
|
(let ((env (make-environment)))
|
||||||
|
(for-each
|
||||||
|
(lambda (m)
|
||||||
|
(let* ((mod2-name+imports (resolve-import m))
|
||||||
|
(mod2 (load-module (car mod2-name+imports))))
|
||||||
|
(%import env (module-env mod2) (cdr mod2-name+imports) #t)))
|
||||||
|
ls)
|
||||||
|
env))
|
||||||
|
|
||||||
(define (load-module name)
|
(define (load-module name)
|
||||||
(let ((mod (find-module name)))
|
(let ((mod (find-module name)))
|
||||||
(if (and mod (not (module-env mod)))
|
(if (and mod (not (module-env mod)))
|
||||||
|
@ -188,7 +198,7 @@
|
||||||
(define *modules*
|
(define *modules*
|
||||||
(list (cons '(scheme) (make-module #f (interaction-environment)
|
(list (cons '(scheme) (make-module #f (interaction-environment)
|
||||||
'((include "init.scm"))))
|
'((include "init.scm"))))
|
||||||
(cons '(config) (make-module #f (current-environment) '()))
|
(cons '(meta) (make-module #f (current-environment) '()))
|
||||||
(cons '(srfi 0) (make-module (list 'cond-expand)
|
(cons '(srfi 0) (make-module (list 'cond-expand)
|
||||||
(current-environment)
|
(current-environment)
|
||||||
(list (list 'export 'cond-expand))))))
|
(list (list 'export 'cond-expand))))))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
|
|
||||||
(define-library (scheme eval)
|
(define-library (scheme eval)
|
||||||
(import (scheme))
|
(import (scheme) (meta))
|
||||||
(export eval environment null-environment scheme-report-environment))
|
(export eval environment null-environment scheme-report-environment))
|
||||||
|
|
Loading…
Add table
Reference in a new issue