[CTYP-309] Export typed vars with contracts to untyped namespaces Created: 31/Jan/16 Updated: 01/May/16
|Reporter:||Ambrose Bonnaire-Sergeant||Assignee:||Ambrose Bonnaire-Sergeant|
While statically typed vars are statically checked, we can just call them from an untyped context and pass any data we please. Gradual typing says this is bad, as errors are delayed and are worse.
We take a similar approach to Typed Racket. Each typed def will actually define two vars.
The first var is has a munged name, but otherwise represents the original def exactly.
The second var has the original name, but the static type is used as a contract. It also uses the fully expanded AST from the original var.
Here's how we compile a def in typed file.
Take the following typed function my-plus.
Then we emit a def that is the same as the original but with a new name.
Finally we create a new def for my-plus___typed that casts to appropriate
Pull request: 98