[racket] typed racket and generic interfaces, is there a workaround using properties?
On Sat, Sep 27, 2014 at 9:11 PM, Anthony Carrico <acarrico at memebeam.org> wrote:
> On 09/27/2014 09:49 AM, Alexander D. Knauth wrote:
>> 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))
>
> I didn't realize #:property was legal in typed struct. I guess there
> should be a documentation update here:
> http://docs.racket-lang.org/ts-reference/special-forms.html
No, instead we need to change typed racket to reject those programs.
However, that would break a bunch of code with no easy fix that relies
on getting away with this, so we'll probably have to wait till we have
a real story here.
> BTW change your program to use the given port: (displayln "whatever"
> out) to avoid the double printing problem, although I'm not exactly sure
> why it would have that effect.
It prints multiple times (to hidden output ports) to detect cycles
among other things.
Sam
> Thanks!
>
> --
> Anthony Carrico
>
>
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>