[racket] Typed racket and sync/timeout

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sat Mar 9 09:53:29 EST 2013

On Sat, Mar 9, 2013 at 8:07 AM, Norman Gray <norman at astro.gla.ac.uk> wrote:
>
> Greetings, all.
>
> I'm getting a Typed Racket error
>
>     Type Checker: untyped identifier sync/timeout imported from module <typed/racket> in: sync/timeout
>
> (in DrRacket 5.3.3)
>
> Should I expect sync/timeout to be typed?

Yes, we should add this.

> I'm trying to supply the missing type with
>
> (require/typed racket/async-channel
>                ;[#:opaque Async-Channel async-channel?]
>                [#:struct (async-channel evt) ()]
>                [async-channel-put (Async-Channel Any -> Void)]
>                [make-async-channel (-> Async-Channel)])
> (require/typed racket
>                [#:opaque Event evt?]
>                [sync/timeout ((U False Nonnegative-Real) Event * -> Any)])
>
> Using the [#:opaque Async-Channel async-channel?] appears to work fine in isolation, but I don't seem to be able to declare that async-channel is a subtype of evt (which I think I need, otherwise I get errors such as "Type Checker: Expected Event, but got Async-Channel in: ...").
>
> However the above produces:
>
> ../../../../../Data/LocalApplications/Racket/5.3.3/collects/typed-racket/typed-racket.rkt:40:4: syntax-local-value: not defined as syntax
>   identifier: #<syntax:/checkouts/me/code/ldap-client/src/ldap-client.rkt:32:40 evt>
>>

This is a bug which we should fix -- can you report it via the bug
reporting tool (preferably as a complete example, if this isn't one
already).

> (line 32 of ldap-client is the #:struct line).
>
> I'm not sure what that error message is telling me, but that doesn't look like something I can fix.
>
> I can get round this by declaring sync/timeout to return async-channel (which it always will, in my case), but that's obviously not a general solution.
>
> Best wishes,
>
> Norman
>
>
> --
> Norman Gray  :  http://nxg.me.uk
> SUPA School of Physics and Astronomy, University of Glasgow, UK
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.