Hello guys, I have been porting my MessagePack library to Typed Racket over the last few days and I am almost done, except for some minor things I would like to sort out first, so I was hoping some experienced Racketeers could help me out. Here is the repo, the branch is "typed":
https://gitlab.com/HiPhish/MsgPack.rkt/tree/typed For one, when testing I used to use file paths instead of the library name, but after switching to Typed Racket I get this error: bash-3.2$ raco test test/unpack/extension.rkt raco test: (submod "test/unpack/extension.rkt" test) link: namespace mismatch; reference to a module that is not available reference phase: 0 referenced module: (submod "/Users/hiphish/Developer/msgpack/unpack.rkt" #%contract-defs) referenced phase level: 0 reference in module: (submod "/Users/hiphish/Developer/msgpack/test/unpack/extension.rkt" test) in: idB4.0 context...: (submod /Users/hiphish/Developer/msgpack/test/unpack/extension.rkt test): [running body] /usr/local/Cellar/minimal-racket/6.9/share/racket/pkgs/compiler-lib/compiler/commands/test.rkt:177:16 extension.rkt: raco test: test raised an exception This was after changing the require for `msgpack` to `(file "../../main.rkt")`. The same happens in other test files as well. The other thing is, I need to make the `ext` structure `#:transparent` or else I get this error: > (call-with-input-bytes packed (lambda (in) (unpack in))) > ,bt ; unpack: broke its own contract ; any-wrap/c: Unable to protect opaque value passed as `Any` ; value: #<ext> ; in: the range of ; (-> Input-Port Any) ; contract from: <pkgs>/msgpack/unpack.rkt ; blaming: <pkgs>/msgpack/unpack.rkt ; (assuming the contract is correct) ; at: <pkgs>/msgpack/unpack.rkt:24.9 ; context...: ; /usr/local/Cellar/minimal-racket/6.9/share/racket/collects/racket/contract/private/blame.rkt:159:0: raise-blame-error16 ; /usr/local/Cellar/minimal-racket/6.9/share/racket/collects/racket/contract/combinator.rkt:176:4 ; /usr/local/Cellar/minimal-racket/6.9/share/racket/collects/racket/contract/private/arrow-higher-order.rkt:145:21 ; /usr/local/Cellar/minimal-racket/6.9/share/racket/pkgs/xrepl-lib/xrepl/xrepl.rkt:1448:0 ; /usr/local/Cellar/minimal-racket/6.9/share/racket/collects/racket/private/misc.rkt:88:7 > If I try unpacking the data in a Typed Racket REPL it works fine, the issue only happens in regular Racket. The next question is not a problem but more about style. In the `unpack.rkt` module I need to read bytes, and the result is of type `(U Byte EOF)`, so I need to use `cond` to distinguish between whether the result is a byte or the `#<eof>`, and I raise an exception when an `#<eof>` is encountered where a byte is expected. Is my way of doing it the right way? And finally, what about the documentation? Does it need special treatment to account for Typed Racket or can I leave it as it is? -- 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.