Fork me on GitHub
#cljs-dev
<
2019-08-08
>
scknkkrer20:08:46

I know, when I ask this questions and take your time, it’s not the contribution. But, I’ve some questions. I’ve been volunteer for the cljs-3152. Which says; > Throw complier exception when method names start with . special. I think I have to dig down to the Analyzer. Which I did. In Analyzer, parse-invoke* method seems nice to me. I have implement a control that takes name of the fexpr --I think it means; Function Expression--.

(when ^boolean fn-var?
      (let [{^boolean variadic :variadic? :keys [max-fixed-arity method-params name ns macro]} (:info fexpr)]
      (when (= (first name) ;; +------------------------
                ".")
            (throw (new js/Exception))) ;; Do we have a special Exception type for the Compiler Exceptions? + ----------------------------
        ;; don't warn about invalid arity when when compiling a macros namespace
        ;; that requires itself, as that code is not meant to be executed in the
        ;; `$macros` ns - António Monteiro
        (when (and #?(:cljs (not (and (gstring/endsWith (str cur-ns) "$macros")
                                      (symbol-identical? cur-ns ns)
                                      (true? macro))))
                   (invalid-arity? argc method-params variadic max-fixed-arity))
          (warning :fn-arity env {:name name :argc argc}))))
Am I doin’ good ?

thheller20:08:27

@scknkkrer no. the error should be thrown in def, eg. disallow (defn .xyz [] ...)

thheller20:08:51

(at least thats my impression from the rather short ticket description)

thheller20:08:19

the compile will automatically desugar (.foo bar) calls so (.xyz) would not be callable

scknkkrer21:08:06

That was my first idea. But, I was thinking about, if we do this in the defn macro, it will not be flexible as we will need.

scknkkrer21:08:13

Maybe, I was wrong.

thheller21:08:24

there are a bunch of checks a bit further down already. looks like a good place to add that check

thheller21:08:44

but first confirm with David that this is actually what he meant. I might be wrong.

scknkkrer21:08:02

@dnolen What do you say boss, shall I ?