Typed Racket should raise an error saying something like "(Setof Any) cannot be translated to a contract". Then elaborate in the docs where you discuss interaction with untyped code about what types cannot be converted to contracts and maybe why.

Ryan


On 09/18/2012 06:00 PM, Sam Tobin-Hochstadt wrote:
I'm saying that I don't at the moment know how to avoid giving this
error, given the current behavior of `set/c`.

On Tue, Sep 18, 2012 at 5:57 PM, Robby Findler
<ro...@eecs.northwestern.edu> wrote:
Are you saying it is reasonable that a typed racket program should
produce contract constructor errors like that?

Robby

On Tue, Sep 18, 2012 at 4:53 PM, Sam Tobin-Hochstadt <sa...@ccs.neu.edu> wrote:
The problem here is that `Any` is a special contract which isn't a
"chaperone contract", and `set/c` requires chaperone contracts.

It's not obvious to me if this can be detected statically, but you can
work around this by changing `Any` to some other type.

Sam

On Tue, Sep 18, 2012 at 5:44 PM, Tony Garnock-Jones <to...@ccs.neu.edu> wrote:
Hi all,

What could I be doing wrong here?

     #lang typed/racket
     (provide (struct-out foo))
     (struct: foo ([bar : (Setof Any)]))

Racket 5.3.0.24 complains about it ("racket problem.rkt"):

     set/c: contract violation
       expected: chaperone-contract?
       given: #<make-contract>
       context...:
        /Users/tonyg/src/racket-typed-matrix/problem.rkt: [running body]

The complaint vanishes if I comment out the provide, remove the bar
field, or change the bar field's type to Any/Integer/etc.

   Tony
____________________
   Racket Users list:
   http://lists.racket-lang.org/users



--
sam th
sa...@ccs.neu.edu
____________________
   Racket Users list:
   http://lists.racket-lang.org/users




____________________
 Racket Users list:
 http://lists.racket-lang.org/users

Reply via email to