Reverse order of args to make-library-import and make last optional.
authorChris Hanson <org/chris-hanson/cph>
Fri, 5 Oct 2018 03:17:33 +0000 (20:17 -0700)
committerChris Hanson <org/chris-hanson/cph>
Fri, 5 Oct 2018 03:17:33 +0000 (20:17 -0700)
src/runtime/library-imports.scm
tests/runtime/test-library-imports.scm

index c86dbaf92cc3bd9ed2a5037d8d66f7171c78c29d..4804c11f2641298230da284eaa33be46068b1278 100644 (file)
@@ -87,9 +87,9 @@ USA.
                (filter-map (lambda (name)
                              (let ((filtered (filter name)))
                                (and filtered
-                                    (make-library-import filtered
+                                    (make-library-import library-name
                                                          name
-                                                         library-name))))
+                                                         filtered))))
                            (library-metadata-exports
                             (library-db 'get-metadata library-name)))))
             ((only)
@@ -131,24 +131,28 @@ USA.
              (or (eq? (car names) (cadr names))
                  (loop (cdr names)))))))
 
+(define (make-library-import from-library from #!optional to)
+  (%make-library-import from-library from
+                       (if (default-object? to) from to)))
+
 (define-record-type <library-import>
-    (make-library-import to from from-library)
+    (%make-library-import from-library from to)
     library-import?
-  (to library-import-to)
+  (from-library library-import-from-library)
   (from library-import-from)
-  (from-library library-import-from-library))
+  (to library-import-to))
 
 (define-print-method library-import?
   (standard-print-method 'library-import
     (lambda (import)
-      (list (library-import-to import)
+      (list (library-import-from-library import)
            (library-import-from import)
-           (library-import-from-library import)))))
+           (library-import-to import)))))
 
 (define (library-import=? e1 e2)
-  (and (eq? (library-import-to e1)
-           (library-import-to e2))
+  (and (equal? (library-import-from-library e1)
+              (library-import-from-library e2))
        (eq? (library-import-from e1)
            (library-import-from e2))
-       (equal? (library-import-from-library e1)
-              (library-import-from-library e2))))
\ No newline at end of file
+       (eq? (library-import-to e1)
+           (library-import-to e2))))
\ No newline at end of file
index bb2ae80b7676afbbd3e7cfdba240bb0a7074ab81..caa56ee29308c4ffbb5e012c9a9ef65e20716a51 100644 (file)
@@ -37,39 +37,25 @@ USA.
                                       (parse-define-library-form
                                        ex1 test-pathname))
                                      (build-metadata-db))
-                 (list (make-library-import 'foo-mumble?
-                                            'foo-mumble?
-                                            '(foo mumble))
-                       (make-library-import 'make-foo-mumble
-                                            'make-foo-mumble
-                                            '(foo mumble))
-                       (make-library-import 'foo-mumble-a
-                                            'foo-mumble-a
-                                            '(foo mumble))
-                       (make-library-import 'foo-mumble-b
-                                            'foo-mumble-b
-                                            '(foo mumble))
-                       (make-library-import 'grumble-foo-grumble?
+                 (list (make-library-import '(foo mumble) 'foo-mumble?)
+                       (make-library-import '(foo mumble) 'make-foo-mumble)
+                       (make-library-import '(foo mumble) 'foo-mumble-a)
+                       (make-library-import '(foo mumble) 'foo-mumble-b)
+                       (make-library-import '(foo grumble)
                                             'foo-grumble?
-                                            '(foo grumble))
-                       (make-library-import 'grumble-make-foo-grumble
+                                            'grumble-foo-grumble?)
+                       (make-library-import '(foo grumble)
                                             'make-foo-grumble
-                                            '(foo grumble))
-                       (make-library-import 'grumble-foo-grumble-a
+                                            'grumble-make-foo-grumble)
+                       (make-library-import '(foo grumble)
                                             'foo-grumble-a
-                                            '(foo grumble))
-                       (make-library-import 'grumble-foo-grumble-b
+                                            'grumble-foo-grumble-a)
+                       (make-library-import '(foo grumble)
                                             'foo-grumble-b
-                                            '(foo grumble))
-                       (make-library-import 'foo-quux?
-                                            'foo-quux?
-                                            '(foo quux))
-                       (make-library-import 'foo-quux-a
-                                            'foo-quux-a
-                                            '(foo quux))
-                       (make-library-import 'foo-quux-b
-                                            'foo-quux-b
-                                            '(foo quux))
-                       (make-library-import 'create-foo-quux
+                                            'grumble-foo-grumble-b)
+                       (make-library-import '(foo quux) 'foo-quux?)
+                       (make-library-import '(foo quux) 'foo-quux-a)
+                       (make-library-import '(foo quux) 'foo-quux-b)
+                       (make-library-import '(foo quux)
                                             'make-foo-quux
-                                            '(foo quux))))))
\ No newline at end of file
+                                            'create-foo-quux)))))
\ No newline at end of file