(define impc:ti:register-new-typealias
(lambda (typealias-name type docstring)
;; (println 'typealias-name: typealias-name 'type: type 'docstring: docstring)
(if (impc:ti:typealias-exists? typealias-name)
(impc:compiler:print-already-bound-error typealias-name (impc:ti:get-typealias-type-pretty typealias-name))
;; check arg types
(if (not (and (or (string? typealias-name) (begin (println 'bad 'typealias-name: typealias-name) #f))
(or (list? type)
(integer? type)
(string? type)
;(and (string? type)
; (impc:ti:namedtype-exists? 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 type alias")
(begin
;; add to the AOT-header if we're precompiling
(set! *impc:ti:typealias-cache*
(cons (cons typealias-name (vector type docstring))
*impc:ti:typealias-cache*))
(car *impc:ti:typealias-cache*)
(impc:aot:insert-typealias-binding-details typealias-name type docstring))))))