clojurescript - Finding unmatched (wrongly matched) parens in clojure code / More meaningful error messages -
i have asked question before (locating unmatched delimiters in clojurescript) , still not have sufficient answer.
i warning of line error such parameter mismatch being detected reader. clojure throws general error naming file no line, etc.
i have either
- clojure specific tool (something lint tool) provides information
- advice on reading stack traces
i have found problem , more precise problem had. compiling clojurescript distributed on code on several files. knew had made changes in 3 of them when discovered code not compile anymore. error message mismatched )
in file a.cljs
on line 1
. quite sure, did not change a.cljs
substantially.
so taking usual way perform when such error occurs (that not often).
- indent whole files vim see if indentation going "nuts".
- use git diff changes in working copy , recent history (i granular commits) find spots changed recently.
this time did not spot change easily. in end found out issue missing ]
in part of file closing parentheses piled up, i.e. )]))])
in middle of other file c.cljs
. reason, vim clojure did not indent following functions more or wrongly, therefore indentation based "detection" did not work.
i reallize there reason why clojure reader not @ spitting out locations of these paren mismatches. please not understand question being condascending. after having looked place quite time, wrote small (~50 lines) stack-based parentheses matching program (in c++ have admit) handles {([
;
-comments , simple "
strings -- nothing close correct parser, yet pointed me right line , characters.
in terms of quality of clojure's error messages: some poor, yet not complaining since clojure's syntax straightforward syntax right (semantics different topic). nevertheless lisp giving such poor error messages on mismatched parens bit unlucky people haven't worked lisp before. know paredit, have used (vim-paredit @ least) , tool work s-expressions. make few things more complicated , have had bad experiences mixing paredit , vim-fugitive.
hacking , contributing clojure core suggested: might option actually, although when browsing through source code takes lot of effort dive in. although @ moment feel rather writing small single-purpose tool used leiningen, might simpler way.
i feel post has provoked people in way. did not mean talk down clojure project, greatful clojure developers providing me programming language.
one reason reporting of error messages not better here, , reason not excuse, majority of people with clojure use paredit-mode or equivalent adds parentheses automatically , makes hard them mismatched. while understand it's not suit , every editor, existence of paredit may explain why there has not been more of concerted push work on this.
clojure realtivly young language and, believe or not, error messages better used be. there increasing number of clojurians looking @ error reporting within compiler , these sort of error messages expected improve. sorry frustration. there many parts of language work on , understand @ least degree makes. patches whole heartedly welcome!
Comments
Post a Comment