I thought it should be possible to use identifier macros to emulate
compile time functions. A ten minutes experimentation seems to give a
positive
answer, at least on Ikarus:

(import (rnrs))

;; define an object at compile time by using an identifier macro
(define-syntax define-ct
  (syntax-rules ()
    ((_ name value)
     (define-syntax name
       (lambda (x)
         (syntax-case x ()
           [(_ . rest) #'(value . rest)]
           [_  #'value]))))))

;; an identifier macro which expands to an auxiliary function
(define-ct foo (lambda () 'bar))

;; a test
(define-syntax macro-using-foo
  (let ()
    (display (foo))
    (syntax-rules () ((_) 'dummy))))

This prints "bar", as expected. Not tested more than you.

Reply via email to