Hello Joe!

IMO this is expected behavior - but doesn't work, as the variable in let
will be generated:

-----------------------------------------------------------------------------------------

(define-syntax bad-macro
        (syntax-rules ()
                ((_ val body) (let ((i val)) body))))

(bad-macro 5 (* 2 i))  ;does not work - "i" in let will be a newly
generated variable


(define-syntax good-macro
        (syntax-rules ()
                ((_ i val body) (let ((i val)) body))))

(good-macro i 5 (* 2 i))  ;does work

-----------------------------------------------------------------------------------------


So you probably need:

(module mm)

(define-class foo a)

(define-syntax darn
   (syntax-rules ()
      ((_ a )
       (let ((v 1))
          (instantiate::foo (a v))))))

(print (darn a))

... which compiles and gives the output:

#|foo [a: 1]|


Best regards

Bent

Reply via email to