Streamline definition of record-type proxies.
authorChris Hanson <org/chris-hanson/cph>
Sat, 17 Mar 2018 23:42:40 +0000 (16:42 -0700)
committerChris Hanson <org/chris-hanson/cph>
Sat, 17 Mar 2018 23:42:40 +0000 (16:42 -0700)
src/runtime/record.scm

index 7fa99276f2f9d46075e94b895f0d08b958aa4c8d..c8fa6810bce47a147e30abbebe1130e51eb67d65 100644 (file)
@@ -231,8 +231,18 @@ USA.
     (set! %proxied-record-types (fixed-objects-item 'proxied-record-types))
     unspecific))
 
-(define record-type-proxy:pathname (%index->record-type-proxy 0))
-(define record-type-proxy:host (%index->record-type-proxy 1))
+(let-syntax
+    ((enumerate-proxies
+      (sc-macro-transformer
+       (lambda (form use-env)
+        (syntax-check '(_ * symbol) form)
+        `(begin
+           ,@(map (lambda (name index)
+                    `(define ,(symbol 'record-type-proxy: name)
+                       (%index->record-type-proxy ,index)))
+                  (cdr form)
+                  (iota (length (cdr form)))))))))
+  (enumerate-proxies pathname host))
 \f
 ;;;; Constructors