It could be made to work, but it currently doesn't because make-struct-type returns 5 functions, one of which is an index-based reference function. If struct were to produce the accessor identifiers in the same define-values as the defined make-struct-type identifiers, this would work. I can make a PR to fix this. -Ian ----- Original Message ----- From: "Alexander D. Knauth" <[email protected]> To: "racket users list" <[email protected]> Sent: Wednesday, July 16, 2014 10:44:24 AM GMT -05:00 US/Canada Eastern Subject: [racket] struct and when the accessors are bound
If I have a program like this: #lang racket/base (define-values (prop:p p? p-ref) (make-struct-type-property 'p)) (struct foo (a) #:transparent #:property prop:p foo-a) It gives me this error: . foo-a: undefined; cannot reference an identifier before its definition Is there a reason why I can’t do this? And is there any way to get around this other than wrapping foo-a in a lambda? I know that this works: #lang racket/base (define-values (prop:p p? p-ref) (make-struct-type-property 'p)) (struct foo (a) #:transparent #:property prop:p (λ (x) (foo-a x))) And I know that it’s not that bad, but is there any other way around it? ____________________ Racket Users list: http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users

