Completed
Details
Details
Assignee
Ambrose Bonnaire-Sergeant
Ambrose Bonnaire-SergeantReporter
Ambrose Bonnaire-Sergeant
Ambrose Bonnaire-SergeantFix versions
Priority
Created November 15, 2015 at 10:53 PM
Updated December 3, 2017 at 11:09 PM
Resolved December 3, 2017 at 11:09 PM
Problem
Writing untyped annotations sucks, and can be especially daunting if you're just starting to port a namespace to typed.
Wouldn't it be great if core.typed provided best-guess annotations that could be copy-pasted into your file?
Solution
Add per-namespace flag to import unannotated vars as a new "Unchecked" type.
Unchecked is both Top and Bottom.
It sticks in an intersection: ie. (I Unchecked Int) does not simplify to Int.
Then `clojure.core/infer-untyped-vars` returns a vector of code you can paste into your buffer (in the same namespace that you flagged) that annotates the unannotated variables. The Unchecked types record how they are used, and the generated annotations reflect this.
Notes
This paper has a very similar Unknown type that replaces Dynamic, but also does complicated escape analysis to ensure Unknown doesn't flow out into dangerous territory.
The Ins and Outs of Gradual Type Inference, POPL '12 https://www.cs.umd.edu/~avik/papers/iogti.pdf
Pull request: https://github.com/typedclojure/core.typed/pull/81