Fork me on GitHub
#cljs-dev
<
2016-12-27
>
potetm02:12:07

I have kind of a random question. Does anybody know for sure why clojure.browser.repl goes through goog.require while node, nashorn, and rhino repls all simply overwrite it? I'm assuming it's because goog.require provides dependency ordering, but that's irrelevant in synchronous loading environments.

anmonteiro08:12:13

@potetm: I think it's not about dep ordering, but rather about dependency loading

martinklepsch13:12:24

Took me a while but I gave the latest extern inference stuff a spin (https://gist.github.com/swannodette/4fc9ccc13f62c66456daf19c47692799)

martinklepsch13:12:38

Pretty cool 👍

martinklepsch13:12:08

I'm a bit confused about where supplying a type hint is possible though. Is it only for argvecs or could I also do something like this somehow:

(def ^js/React react js/React)
and by using react in all further calls get extern inference for free?

martinklepsch14:12:19

Ah, cool. Seems the case of (js/Whatever.create ...) is also covered by inference

martinklepsch14:12:21

Ok so as far as I can see this (similar to the question above) works as well:

(def ^js/Whatever we js/Whatever)

potetm15:12:36

@anmonteiro Yeah. The interesting thing there is that browser.repl does overwrite how script tags are written. So even the loading is handled by cljs. So it seems to me that we could have just skipped the built-in goog.require and proxied to our own tag writer.

potetm15:12:52

However, goog.require does ensure that dependencies are ordered prior to the required script.