From: admin Date: Sat, 23 Sep 2023 04:04:57 +0000 (+0900) Subject: Modularize types X-Git-Tag: v0.1.0~5 X-Git-Url: https://git.vouivredigital.com/?a=commitdiff_plain;h=80a34d8674785939c59526d48d9e67344a374708;p=vouivre.git Modularize types --- diff --git a/curry.scm b/curry.scm index 25b51aa..d2bea84 100644 --- a/curry.scm +++ b/curry.scm @@ -7,10 +7,6 @@ #:use-module (srfi srfi-64) #:use-module (srfi srfi-71) #:use-module (vdc misc) - #:replace - (;(vdc:define . define) - ;(vdc:primitive-eval . primitive-eval) - ) #:export (curried-untyped-define equal-types? @@ -223,13 +219,17 @@ (equal? lst (delete-duplicates lst)))) (define (sym-set! symtab name value) - (assoc-set! symtab name value)) + (let ((m (module-name (current-module)))) + (assoc-set! symtab m + (assoc-set! (or (assoc-ref symtab m) '()) + name value)))) (define (sym-set symtab sym value) (sym-set! (alist-copy symtab) sym value)) -(define (sym-ref bindings name) - (assoc-ref bindings name)) +(define (sym-ref symtab name) + (let ((m (module-name (current-module)))) + (assoc-ref (or (assoc-ref symtab m) '()) name))) (define (populate-tvs! node) (map-tree! @@ -408,10 +408,10 @@ (curried-untyped-define ((name var1) var2 ...) body ...)))) (define (∷% name type) - (set! symtab (assoc-set! symtab name type))) + (set! symtab (sym-set! symtab name type))) (define-syntax-rule (∷ name type) (∷% 'name (parse 'type))) (define (type-of x) - (pt (assoc-ref symtab x))) + (pt (sym-ref symtab x)))