mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
Adding @import and @import-only to the repl.
This commit is contained in:
parent
370d990df5
commit
731a6f6347
1 changed files with 82 additions and 67 deletions
|
@ -124,6 +124,21 @@
|
|||
(lambda (in)
|
||||
(let ((op (read/ss in)))
|
||||
(case op
|
||||
((import import-only)
|
||||
(let* ((mod-name (read in))
|
||||
(mod+imps (eval `(resolve-import ',mod-name)
|
||||
meta-env)))
|
||||
(if (pair? mod+imps)
|
||||
(let ((env (if (eq? op 'import-only)
|
||||
(make-environment)
|
||||
env))
|
||||
(imp-env
|
||||
(vector-ref
|
||||
(eval `(load-module ',mod-name) meta-env)
|
||||
1)))
|
||||
(%import env imp-env (cdr mod+imps) #f)
|
||||
(continue module env meta-env))
|
||||
(fail "couldn't find module:" mod-name))))
|
||||
((in)
|
||||
(let ((name (read/ss in)))
|
||||
(cond
|
||||
|
|
Loading…
Add table
Reference in a new issue