Fork me on GitHub
#shadow-cljs
<
2017-11-05
>
mhuebert14:11:19

pom.xml seems to work well

mhuebert14:11:51

i see some new infer-externs warnings that I didn’t before. Not sure what to do about these defprotocol warnings:

------ WARNING #3 --------------------------------------------------------------
 File: re_view/hiccup/core.cljs:14:1
--------------------------------------------------------------------------------
  10 |     js/Symbol
  11 |     (-pr-writer [sym writer _]
  12 |       (-write writer (str "\"" (.toString sym) "\"")))))
  13 |
  14 | (defprotocol IElement
-------^------------------------------------------------------------------------
 Cannot infer target type in expression (. this re-view$hiccup$core$IElement$to-element$arity$1 this)
--------------------------------------------------------------------------------
  15 |   (to-element [this] "Returns a React element representing `this`"))
  16 |
  17 | (defprotocol IEmitHiccup
  18 |   (to-hiccup [this] "Returns a hiccup form representing `this`"))
  19 |
source: https://github.com/braintripping/re-view/blob/master/re_view/src/re_view/hiccup/core.cljs#L14

thheller14:11:16

I’m working on that currently

mhuebert14:11:04

also

------ WARNING #6 --------------------------------------------------------------
 File: re_view/hiccup/core.cljs:34:9
--------------------------------------------------------------------------------
  30 |             (println form)
  31 |             (.error js/console e)))
  32 |
  33 |
  34 |         (satisfies? IElement form)
---------------^----------------------------------------------------------------
 Cannot infer target type in expression (. form -re-view$hiccup$core$IElement$)
--------------------------------------------------------------------------------
  35 |         (to-element form)

thheller14:11:13

defprotocol, defrecord, deftype all generate bad warnings

thheller14:11:27

yeah implements? satisfies? as well

thheller14:11:57

(list) as well

thheller14:11:38

its a lot more work than I anticipated

mhuebert14:11:42

for something like this:

41 |         (reduce (fn [out el]
  42 |                   (doto out (.push (-to-element el)))) #js [] form)
-----------------------------------^--------------------------------------------
 Cannot infer target type in expression (. G__33183 push (-to-element el))
--------------------------------------------------------------------------------
can ^js annotations go inline, like (.push ^js (-to-element el)) or would implementations of -to-element need to be annotated

thheller14:11:47

guess thats why David didn’t work on it for a year 🙂

thheller14:11:24

whats -to-element?

thheller14:11:40

inline should be fine, but you need to do it every time

thheller14:11:48

would be better to annotate -to-element once

thheller14:11:14

(doto ^js out (.push (-to-element el))))

thheller14:11:35

need to annotate the out not the -to-element

mhuebert14:11:36

there is an IElement protocol with a -to-element method

mhuebert14:11:50

so all the js (as opposed to clj-related) warnings were straightforward to fix

thheller14:11:11

for the others I have to touch sooooo much code since its all generated all over the place

thheller14:11:32

I kinda want to create one function to create the proper symbol and re-use that everywhere

thheller14:11:27

cljs.core changes are scary 🙂

thheller15:11:15

(deftype ShouldNotWarnAboutInfer [foo bar]
  Object
  (yo [x])

  ILookup
  (-lookup [this key]
    ::fake))

thheller15:11:32

I’m unsure what to do about the things on Object

thheller15:11:47

sometimes you want externs for those … sometimes you don’t

thheller15:11:12

eg. implementing shouldComponentUpdate or so

thheller15:11:26

vs something you just use in your own code

mhuebert15:11:37

hmm. what is default behaviour?