define-static   macro


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/llvmti.xtm

Implementation

(define-macro (define-static symname . args)
  (let ((types (cdr (reverse args)))
        (expr (car (reverse args)))
        (aot_sexpr '()))
    (if (regex:match? (symbol->string symname) ":")
        (let ((sres (regex:type-split (symbol->string symname) ":")))
          (set! symname (string->symbol (car sres)))
          (set! types (cons (cons symname (string->symbol (cadr sres))) types))))
    ;; (print-full symname 'types: types 'e: expr 'args: args)
    `(let* ((newname (impc:ti:run ',symname
                                  '(let ((,symname ,expr)) ,symname)
                                  0
                                  #f
                                  #t
                                  ,@(if (null? types)
                                        '()
                                        (map (lambda (k) (list 'quote k)) types)))))
        newname)))


Back to Index