On Fri, May 15, 2020 at 10:07:31AM -0400, Sam Tobin-Hochstadt wrote:
> Generics are not supported yet; you need to use structure type
> properties, like this:
> 
> #lang typed/racket/base
> 
> (: parameter-print : Any Output-Port Any -> Any)
> (define (parameter-print v p b) (fprintf p "hi\n"))
> 
> (struct parameter
>   ([type : String] [name : Symbol] [len : (Option String)] [const? :
> Boolean] [stars : Integer])
>   #:property prop:custom-write  parameter-print)

Thank you.  That worked.

But according to section 2.5 of the typed Racket reference, #:property 
is not one of the allowed options in struct.

Perhaps the documentation needs to be updated/

-- hendrik
 
> 
> On Fri, May 15, 2020 at 8:00 AM Hendrik Boom <[email protected]> wrote:
> >
> > How does one provide a method to print strutures in typed Racket?
> >
> > (struct parameter
> >
> >   ([type : XML] [name : Symbol] [len : (Option String)] [const? : Boolean] 
> > [stars : Integer])
> >   #:methods gen:custom-write [(define write-proc parameter-print)]
> >   )
> >
> > seems not to work.  But something like this did work in untyped Racket.
> > Is there some other way to do this?
> >
> > -- hendrik
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to [email protected].
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/20200515120026.ski2o43crgtnsnr3%40topoi.pooq.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/CAK%3DHD%2BZFMR0evj%2B%3DcoeQaaQ602f7rGj76HtNc7N3bswipH7aEg%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200515143347.ceg34vkaelx6sdu2%40topoi.pooq.com.

Reply via email to