Fork me on GitHub
#cljs-dev
<
2018-08-19
>
mfikes12:08:26

With https://dev.clojure.org/jira/browse/CLJS-1997, one thing we could consider is adding a compiler option akin to :static-fns, perhaps with a name like :infer-fn-return-type or somesuch, which is disabled for functions defined in the REPL. (The rationale would be to avoid code based on such definitions becoming invalid if the user re-defines, changing the inferred type—this was discussed a little in CLJS-1997). By doing so, we might be giving up on some good compiler warnings https://twitter.com/mfikes/status/1030948715467616256 but instead favoring correctness while in the REPL. This could become more important if we make more use of inferred return types during code gen. See https://dev.clojure.org/jira/browse/CLJS-2865 which feels like giving inferred string importance just like inferred boolean.

mfikes13:08:39

Type inference could potentially flow into the then branch of an if, based on predicates used in the test. Wondering if there is anything that could go wrong with this kind of change: https://dev.clojure.org/jira/browse/CLJS-2866