This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-12
Channels
- # alda (3)
- # beginners (17)
- # boot (157)
- # cider (15)
- # cljs-dev (30)
- # cljsjs (4)
- # cljsrn (5)
- # clojure (70)
- # clojure-austin (3)
- # clojure-canada (2)
- # clojure-colombia (1)
- # clojure-czech (1)
- # clojure-dev (27)
- # clojure-greece (34)
- # clojure-japan (6)
- # clojure-russia (114)
- # clojure-sg (3)
- # clojure-uk (8)
- # clojurescript (63)
- # cursive (9)
- # datomic (40)
- # devcards (11)
- # euroclojure (4)
- # events (8)
- # hoplon (61)
- # incanter (1)
- # instaparse (16)
- # jaunt (6)
- # jobs (6)
- # jobs-discuss (52)
- # ldnclj (1)
- # leiningen (2)
- # off-topic (3)
- # om (73)
- # onyx (101)
- # overtone (25)
- # re-frame (18)
- # reagent (6)
- # ring (7)
- # ring-swagger (36)
- # spacemacs (5)
- # sydney (1)
- # untangled (41)
- # yada (6)
A question related to extend-type
for IFn
protocol
Why the transpiled code contains implementation for call
, apply
and also cljs$core$IFn$_invoke$arity$1
?
Look here: http://app.klipse.tech/?cljs_in=(ns%20my.regexp)%0A%0A(extend-type%20js%2FRegExp%0A%20%20IFn%0A%20%20(-invoke%20%0A%20%20%20%20(%5Bmatch%20s%5D%20(re-find%20match%20s))))%0A%0A(%23%22clojure%22%20%22clojurescript%22)%0A&js_only=1
In my understanding, the code for cljs$core$IFn$_invoke$arity$1
is not required
@viebel if you compile with :static-fns true
the call will be /clojure/.cljs$core$IFn$_invoke$arity$1(null,"clojurescript");
@thheller even with :static-fns true
, the function call occurs with /clojure/.call()
as to why you aren’t seeing that - I have no idea - but only interested in hearing about potential problems through ClojureScript only
Maybe unused code is emitted is my specific use case?
What do u mean by " optimized calls will get emitted that’s why"?
@viebel: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/compiler.cljc#L1008-L1013
if the compiler cannot determine that fn arity is statically knowable but :static-fns true
it will emit a conditional
in what cases fn arity is not statically knowable?
it’s a bit cryptic. sorry
and no I don’t expect that you will understand precisely how :invoke
works without spending a day or two on it
I understand