-
Notifications
You must be signed in to change notification settings - Fork 76
Low Hanging Fruit
The two main activities crucial in these early versions of core.typed are
- Porting existing untyped code to typed
- Typing core Clojure functions
These processes will reveal bugs in type checker and expressiveness limitations of core.typed types. For example, currently keyword parameters are not supported.
Watch the first three episodic screencasts (above) that demonstrate some of the techniques involved in these activities.
Often if a core function is untyped, the type can be temporarily added via your own namespace
with ann
.
This also applies to Clojure's clojure.lang
Java classes (alter-class
) and methods
(override-method
, non-nil-return
, nilable-param
) (raw method calls
often result from inlining core functions).
Core Clojure function annotations belong in the typed/ann.clj
file.
They should be fully namespace qualified, like (ann clojure.core/*ns* clojure.lang.Namespace)
.
Porting a namespace involves
- annotating var
def
s from the current namespace withann
, conventionally above thedef
- checking the namespace with
check-ns
(calling with zero arguments checks the current namespace) - adding missing core Clojure annotations with
ann
temporarily in the current namespace - wrapping troublesome top-level forms with
tc-ignore
so they skip type-checking