Assumptions:
- I get that type of hints is performance optimization, not type checking. I try to work when performance optimization is ineffective.
Suppose I have the following code:
(ns test.core)
(defrecord SquarePeg [width length])
(defrecord RoundHole [radius])
(def square-peg (SquarePeg. 5 50))
(defn insert-peg [^test.core.RoundHole peg]
(println "insert-peg inserted with: " peg))
(defn -main
"Insert a square peg in a round hole"
[& args]
(insert-peg square-peg))
When I run it, I get:
insert-peg inserted with:
Now I expect this to have some indication that the type hint was wrong, but it is not.
Now I will look at the Clojure compiler code - and I see the following hint processing code:
But I don't see a bit where it handles a hint type failure.
: Clojure ?