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 ?@scknkkrer no. the error should be thrown in def
, eg. disallow (defn .xyz [] ...)
(at least thats my impression from the rather short ticket description)
the compile will automatically desugar (.foo bar)
calls so (.xyz)
would not be callable
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.
Maybe, I was wrong.
not in the macro. probably here https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer.cljc#L1832
there are a bunch of checks a bit further down already. looks like a good place to add that check
but first confirm with David that this is actually what he meant. I might be wrong.
@dnolen What do you say boss, shall I ?