|
|
|
|
|
by ryanbrush
4672 days ago
|
|
A perhaps naive question: could this sort of thing tap into Clojure's type hints rather than using external annotations? So rather than writing the example in the post: (ann my-inc [Number -> Number]) (defn my-inc [n]
(let [internal-number (Integer/parseInt "1")]
(+ n internal-number))) one could write this: (defn ^Number my-inc [^Number n]
(let [internal-number (Integer/parseInt "1")]
(+ n internal-number))) ...and then run a type checker that reads and analyzes the hints? Of course, the core.typed annotations could preserve whatever information they need in the compiled output, whereas the type hints aren't preserved past the compile phase (as far as I can tell.) Is that the limitation that requires defining type information in separate annotations? |
|