Fork me on GitHub
#cljs-dev
<
2018-11-23
>
dnolen16:11:58

pushed the predicate based inference stuff, narrowed a bit from Mike's original commit

dnolen17:11:26

with a couple of other enhancements this could probably lead to removing many of the manual perf oriented type hints in the standard lib

mfikes17:11:33

This is getting cool. With master + CLJS-2869 + CLJS-2865, I now get

cljs.user=> (inferred-type (pr-str 1))
string

dnolen17:11:00

I'm a bit confused about CLJS-2869?

dnolen17:11:10

is the idea just to short circuit the inferred type?

dnolen17:11:42

@mfikes 2865 is independent yes?

dnolen17:11:53

that one just seems like an obvious win

mfikes17:11:29

@dnolen Yes, CLJS-2865 is independent. And CLJS-2869 is about inferring the correct types when short-circuit is statically known to happen, which may be less important. There may be subtle corner cases where CLJS-2869 helps narrow inference down to the correct type. But I don't have a good handle on how often that happens. An example where CLJS-2869 helps with cljs.core/dominates: Without CLJS-2869, you get #{boolean clj-nil}, but with it, it correctly infers as boolean.

dnolen18:11:09

@mfikes hrm interesting, will continue to think about it

mfikes18:11:24

Yeah, no need to rush CLJS-2869. Perhaps we need more evidence for its need.

dnolen18:11:03

you didn't rebase the loop/recur one did you?

dnolen18:11:24

oh that didn't need a rebase - just some inference tests

dnolen18:11:42

specifically would be nice to have cases that didn't work before

mfikes18:11:04

Yeah—IIRC the loop / recur ticket had some slight perf concerns (potentially multiple analysis passes, but with it giving up after one additional pass.) So perf might be OK, and it just needs tests at this point.

dnolen18:11:06

I think two passes is probably ok, gut feeling loop/recur isn't common enough to matter