(hash-table-exists? table name))
(define (get name)
- (hash-table-ref table name))
+ (let ((library (hash-table-ref/default table name #f)))
+ (if (not library)
+ (error "No library of this name in database:" name this))
+ library))
(define (put! library)
(if (and (library 'has? 'db)
(if (not auto)
(error "Unknown property:" key))
(if (not (auto-runnable? auto this))
- (error "Auto property not ready:" auto))
+ (error "Auto property not ready:" key))
(let ((bindings (run-auto auto this)))
(set-cdr! alist (append bindings (cdr alist)))
(cdr (assq key bindings)))))))
(declare (usual-integrations))
\f
-(define (parsed-import-expandable? import db)
- (let ((name (parsed-import-library import)))
- (and (registered-library? name db)
- ((registered-library name db) 'has? 'exports))))
-
(define (expand-parsed-imports imports db)
+ (let ((unusable
+ (remove (lambda (import)
+ (let ((name (parsed-import-library import)))
+ (and (registered-library? name db)
+ ((registered-library name db) 'has? 'exports))))
+ imports)))
+ (if (pair? unusable)
+ (error "Unknown imports:" (map parsed-import-library unusable))))
(reduce-right append!
'()
(map (lambda (import)
imports)))
(define-automatic-property 'imports '(parsed-imports db)
- (lambda (imports db)
- (every (lambda (import)
- (parsed-import-expandable? import db))
- imports))
+ #f
expand-parsed-imports)
;;; Returns a list of library-import elements.
(define (environment . import-sets)
(let ((parsed (map parse-import-set import-sets))
(db host-library-db))
- (let ((unusable
- (remove (lambda (import)
- (parsed-import-expandable? import db))
- parsed)))
- (if (pair? unusable)
- (error "Imports not usable:" unusable)))
(let ((imports (expand-parsed-imports parsed db)))
(let ((unavailable
(remove (lambda (import)
(files "library-imports")
(parent (runtime library))
(export (runtime library)
- expand-parsed-imports
- parsed-import-expandable?))
+ expand-parsed-imports))
(define-package (runtime library scode)
(files "library-scode")