Replies: 1 comment
-
|
There are a few considerations here.
What it sounds like you want is something like how typed modules work today, except in reverse -- any typed client gets the contracted version, and other clients get the uncontracted version. That's of course doable with the underlying Typed Racket infrastructure, but there would be a bunch of work to make it accessible and configurable to work in this way. A different option is just to specify the types things should have without adding contracts. There's better support for that already; see for example how typed/racket/sandbox works. You could use that to have |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like Typed Racket users to be able to use my rebellion package, which is written in untyped racket. As I understand it, there's a few ways to do that:
require/typed.typed/rebellion/base/optionthat userequire/typed.Option 1 is probably not doable because a lot of rebellion's implementations use the custom type definition forms I created in
rebellion/type, likedefine-record-type. If anyone knows how to teach Typed Racket that those macros are similar tostruct, I'm all ears. It's not as simple as just letting TR run on the expanded code, since they don't expand tostructforms: they expand to code that callsmake-struct-typeat runtime.Option 2 is a lot of work for clients, as they have to repeat type signatures in every module that requires a rebellion module. I'd much rather just write the wrapper once somewhere.
Option 3 seems like the best available choice, but I don't like that there's now two separate modules for the same API.
Can we design a way to have a single untyped module X, but tell typed racket users that when they require X they should add type signatures A, B, and C and check them with contracts? Maybe through some sort of
type-signaturessubmodule in X that TR knows how to look for?Note: I'm fine with only providing typed racket enough information for it to make shallow checks. I'm not looking for soundness yet, all I want for now is to be able to catch at least some of the cases where I forgot an argument to a function or I mixed up the order of some arguments.
Beta Was this translation helpful? Give feedback.
All reactions