> I've noticed that Typed Racket adds seemingly unnecessary chaperones when > the Any type is involved, but maybe they are necessary for some reason? The > following code tries to create a chaperone that I don't think is necessary. > > #lang racket > > (module m typed/racket > (provide f) > (: f (-> Any Any)) > (define (f x) x)) > (require 'm) > > (struct s (a b) #:transparent #:authentic) > (f (s 1 2)) > > Is there a reason for the chaperone? Should I report this and similar > situations as Github issues?
Typed Racket uses Any chaperones to protect its values from untyped code. For example, if typed code sent a vector to untyped, then the Any chaperone would prevent `vector-set!`s I agree the chaperone isn't necessary in your example because `f` never receives a typed value. I also can't think of a way to use an un-chaperoned version of `f` to break type soundness ... so maybe there is a general principle here, about how a typed function creates an Any result, that TR could learn. If you have ideas and/or more examples, then yes please open an issue. -- 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/CAFUu9R772b608dSGMgatukR%2BtaaSZokDaTKxek_n%3D4bhfczrgg%40mail.gmail.com.

