Like this, I think: (but for some reason it seems to print it 3 times?) #lang typed/racket
(struct foo () #:transparent #:property prop:custom-write (lambda (this out mode) (displayln "whatever"))) (print (foo)) On Sep 26, 2014, at 11:07 PM, Anthony Carrico <acarr...@memebeam.org> wrote: > Dredging up an old thread: So how exactly do you define custom-write for > a typed racket struct? > > On 05/25/2014 03:30 PM, Alexander D. Knauth wrote: >> Never mind I just found prop:dict. >> >> By the way it would probably be helpful if instead of the value for >> prop:dict being a vector, it was a hash table with the method names >> as the keys, so then it would be a lot easier to tell which procedure >> goes with which method, and also a lot easier to extend it while >> maintaining backwards compatibility. >> >> On May 24, 2014, at 10:38 PM, Alexander D. Knauth >> <alexan...@knauth.org> wrote: >> >>> Do generic interfaces work using structure type properties, and if >>> they do, is there a way to use generic interfaces through >>> properties so that I can do it in typed racket? >>> >>> Specifically I’m trying to use the gen:custom-write and gen:dict >>> generic interfaces. I can use prop:custom-write for the first one, >>> but I don’t know what to do for gen:dict. >>> >>> Otherwise I’ll just put it in an untyped submodule. > > -- > Anthony Carrico > > ____________________ > Racket Users list: > http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users