Add encapsulation, sum types, type constraints and all the required machinery. Also -> threading macro #64

Merged
pkulev merged 40 commits from static-dispatch into main 2026-10-19 17:07:45 +02:00
Showing only changes of commit 2512d52dd1 - Show all commits

View File

@@ -65,12 +65,16 @@
module-path)))) module-path))))
(define (read-public-interface module-path) (define (read-public-interface module-path)
;; pub fns are reduced to prototypes, other pub forms are just pasted ;; pub fns are reduced to prototypes, other pub forms are just pasted.
;; Declaration order is kept: a module that declares a type and then a
;; pub fn taking it has to paste them that way round, or the prototype
;; names a type C has not seen.
(let ((raw-forms (read-from-file module-path))) (let ((raw-forms (read-from-file module-path)))
(fold (reverse
process-public-interface-form (fold
(list) process-public-interface-form
raw-forms))) (list)
raw-forms))))
(define (public-fn-interface raw-form) (define (public-fn-interface raw-form)
;; (pub fn name args ret . body) -> prototype, keeping a docstring so ;; (pub fn name args ret . body) -> prototype, keeping a docstring so