(define impc:ti:register-new-namedtype
(lambda (namedtype-name type docstring)
;; (println 'namedtype-name: namedtype-name 'type: type 'docstring: docstring)
(if (impc:ti:namedtype-exists? namedtype-name)
'donothing ;;(impc:compiler:print-already-bound-error namedtype-name (impc:ir:pretty-print-type type))
;; check arg types
(if (not (and (or (string? namedtype-name) (begin (println 'bad 'namedtype-name: namedtype-name) #f))
(or (list? type) (integer? type) (begin (println 'bad 'type: type) #f))
(or (string? docstring) (begin (println 'bad 'docstring: docstring) #f))))
(impc:compiler:print-compiler-error "couldn't register new named type")
(begin
;; add to the AOT-header if we're precompiling
(set! *impc:ti:namedtype-cache*
(cons (cons namedtype-name (vector type docstring))
*impc:ti:namedtype-cache*))
(car *impc:ti:namedtype-cache*)
(impc:aot:insert-namedtype-binding-details namedtype-name type docstring))))))