Declined
Details
Assignee
Ambrose Bonnaire-SergeantAmbrose Bonnaire-SergeantReporter
Ambrose Bonnaire-SergeantAmbrose Bonnaire-SergeantLabels
Fix versions
Priority
Major
Details
Details
Assignee
Ambrose Bonnaire-Sergeant
Ambrose Bonnaire-SergeantReporter
Ambrose Bonnaire-Sergeant
Ambrose Bonnaire-SergeantLabels
Fix versions
Priority

Created February 1, 2016 at 2:45 AM
Updated December 3, 2017 at 11:07 PM
Resolved December 3, 2017 at 11:07 PM
Problem
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.
Solution
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.
How to compile typed def's
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
formy-plus___typed
that casts to appropriatePotholes
Recursive functions
Which var to rewrite to in the body?
Keeping vars up to date
What happens on
alter-var-root!
ordef
Is it just now part of the semantics? "Deal with it"?
Pull request: 98