Overwriting symbols that are defined in cljs.core works fine and prints an expected warning. One case where this fails is when a symbol that was replaces was originally a macro and it's invoked without namespace qualification. An example:
`
}
;;;;;;; file a ;;;;;;
(ns file.a)
(defn + [& vals]
(prn "Called!")
(apply cljs.core/+ vals))
;;;;;;; file b ;;;;;;
(ns file.b
(:require [file.a :refer [+]]))
(+ 1 2 ) ;; Doesn't print "Called!"
(file.a/+ 1 2) ;; Prints "Called!"
(var +) => file.a/+
(+ 1 2) ;; Prints "Called!"
``
}
The same symbol +
alone by itself in file b calls cljs.core/+ despite it being referred and all var resolution resolves to file.a/+. This seems not to be the case when overwriting functions from cljs.core, for example overwriting the function map
works fine.
`
;;;;;;; file a ;;;;;;
(ns file.a)
(defn map [f coll]
(prn "map called!")
(cljs.core/map f coll))
;;;;;;; file b ;;;;;;
(ns file.b
(:require [file.a :refer [map]]))
(map inc [1 2 3]) => "map called!" (2 3 4)
`
}