Fork me on GitHub
#cljs-dev
<
2019-08-09
>
dnolen00:08:47

it should really be disallowed in all cases where it cannot possibly be a method call

dnolen00:08:29

well dot form really

andy.fingerhut07:08:24

I am confused by the definition of function js-obj in cljs.core. The 0 arity looks like a recursive call to me, but it certainly returns quickly without infinitely recursing. Is someone familiar with what is going on there?

andy.fingerhut07:08:09

Here is the defn for quick reference:

(defn js-obj
  "Create JavaSript object from an even number arguments representing
  interleaved keys and values."
  ([]
     (cljs.core/js-obj))
  ([& keyvals]
     (apply gobject/create keyvals)))

andy.fingerhut07:08:50

Maybe that is dead code?

andy.fingerhut07:08:53

When I try to declare my own similar function, it does call the 0 arity, and recurses infinitely. Hmmm.

andy.fingerhut10:08:23

ah, that makes sense then why I couldn't find it in the same source file with the defn of js-obj.

dnolen13:08:06

@andy.fingerhut this is a difference from Clojure

dnolen13:08:15

ClojureScript macros and fns can have the same name

mfikes15:08:31

^ That's non-normative, we have formal language in https://clojurescript.org/about/differences#_macros FWIW