Well, you can do something like this: #lang racket (struct thing (name) #:transparent #:methods gen:custom-write [(define (write-proc thing out mode) (implementation thing out mode))]) stuff … (define (implementation thing out mode) (display (thing-name thing) out))
On Feb 6, 2015, at 10:13 PM, Anthony Carrico <[email protected]> wrote: > It seems like the implementation of a generic method must come before > the structure definition: > > (struct Protocol (name interfaces) > #:transparent > #:methods gen:dumpable > ((define dump dump-Protocol))) > > (define (dump-Protocol p out) ...) > > ; dump-Protocol: undefined; > ; cannot reference an identifier before its definition > > Is this a bug? Just a limitation? > > -- > Anthony Carrico > > ____________________ > Racket Users list: > http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users

