On Wed, Sep 7, 2016 at 10:35 AM, Tim Brown <tim.br...@cityc.co.uk> wrote:
> ffi-types.rkt:19 is: > .. > 17 (require/typed > 18 ffi/unsafe > *19 [#:opaque CPointer cpointer?] ; includes Bytes and other things > that can be used as cpointers > 20 [#:opaque CType ctype?] > 21 ) > .. > which seems perfectly innocuous to me :-/ > You're right, it's innocuous. So we can use `unsafe-require/typed`: #lang typed/racket/base (require (only-in typed/racket/unsafe unsafe-require/typed)) (unsafe-require/typed ffi/unsafe [#:opaque CPointer cpointer?] [#:opaque CType ctype?] ) (require/typed ffi/unsafe [malloc (-> Fixnum CPointer)] ) (malloc 4) ;; no warnings --- Here's the discussion behind the warning messages: https://github.com/racket/typed-racket/pull/396 Basically, the trouble is that `cpointer?` might be an evil untyped function: (define (cpointer? x) (when (box? x) (set-box! x 'EVIL)) #t) Typed Racket can't be sure, so it tries to protect all arguments to `cpointer?`. But when you call `(cpointer? v)` where `v` is a `#<cpointer>`, Typed Racket warns you that it doesn't know how to protect `#<cpointer>` values. -- 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 racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.