Fork me on GitHub

btw, i've fetched quite a few github repositories containing clj code and run one of the grammars over the contained clj and cljc files to see how it does.


it's helped to identify a few weak spots and am working on seeing if they can be attended to.


it's also brought up a number of points regarding actual usage vs docs on


e.g. if you read: (also see keyword section) -- you might think that putting # in a symbol or keyword is not a good idea (it's not listed as an allowed character). it turns out that music-oriented code seems to like using it in keywords (e.g. :A#) and there are a few other places # seems to be used in keywords. apart from what the docs say, i think use of # in a symbol is a potential problem because of the use of # in gensyms -- at least i think it may be likely to confuse tooling. another thing is use of slashes. there are some folks who seem to like to use slashes in keywords for: urls, file paths, etc. -- this seems to be in conflict with the aforementioned page. another slash usage that comes up is :/. (i'm inclined toward allowing my-ns// to refer to something defined as / in my-ns.)


i'm not terribly surprised to find these things -- just wondering what to do about them 🙂


one idea is to have a grammar that is very strict -- you could use this as a kind of linter may be (not sure if tree-sitter would require some tweaking) -- and another that is more lenient.


Does clj-kondo warn about any of those?


i've been running clj-kondo on some of the files that were fetched. sometimes clj-kondo gives errors, sometimes not. regarding :/ i learned that in june of last year, there was a discussion and iiuc it's now considered legal -- though i'm not quite sure how to interpret the conversation. it did seem to lead to changes in cljs though.


i've also tested things at the repl -- the repl is more permissive than the docs, and sometimes load-file is more permissive than the repl.


i'm not going to take the repl as the source of truth, though i think if something manages to get in through the repl, that should be considered a factor.