Hello,

With this macro:

(define-syntax (struct-abc stx)
  (syntax-case stx ()
    [(_ name (args ...) props ...)
     #`(begin
     (+ 1 1)
     (struct name (args ...) props ...
         #:property prop:insiders person-name))]))

(define-values (prop:insiders insiders? insiders-ref)
  (make-struct-type-property 'insider))


When i do :

(struct-abc person (name nickname))

I get :

person-name: undefined;
 cannot reference an identifier before its definition

But i know that person-name is defined the problem come from 'begin' in the macro, if i rewrite like this :

(define-syntax (struct-abc stx)
  (syntax-case stx ()
    [(_ name (args ...) props ...)
     #`(struct name (args ...) props ...
         #:property prop:insiders person-name)]))

It works as expected.

So my question are:

Could you explain (point out) me why the person-name is unknown at this point?
And how can i change the begin with something like '#,@'?

Thank you.
____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to