r/Clojure • u/alexdmiller • Jan 07 '19
State of Clojure 2019 Survey
https://clojure.org/news/2019/01/07/clojure-2019-survey3
u/dustingetz Jan 08 '19
Re. "namespaces improvements" I would like to see thought guidance regarding data namespaces and/or tooling improvements that show a clear right way to do this
1
u/nogridbag Jan 07 '19
I took the survey but when I clicked "Next" after answering all questions it simply brought me to the same page with no confirmation that the survey was submitted. Strange.
1
1
1
24
Jan 07 '19
[removed] — view removed comment
4
u/nogridbag Jan 07 '19
This was also my feedback in the final comment question although you stated it much more eloquently. If I had to rely solely on the doc strings it's possible I might have even given up on Clojure. Since I'm also a beginner I find I'm spending most of my time referencing the top 1 or 2 examples on ClojureDocs and avoiding the doc string completely. Right now I'm just tinkering but it makes me a little fearful that using Clojure in a large app without spec or disciplined developers may become really difficult to follow.
I've bought into the idea of preferring maps over Objects but I must admit one of Java's killer tools is JavaDoc.
3
u/alexdmiller Jan 08 '19
There are many, many great beginner resources for Clojure. Is there some reason you felt you may have had to rely only on docstrings? I think it's unrealistic to expect to learn any language based just on the API docstrings alone. Is there some point during when you were getting started that would have been an opportune place to suggest beginner resources?
4
u/nogridbag Jan 08 '19
Oh I definitely didn't have to rely solely on docstrings. I read Brave Clojure and your book Programming Clojure! Both are excellent resources. But often I forget the exact usage of some function and looking through examples in books for a specific function's usage is more time consuming than a reference website or typing (doc "something") in the repl. My previous comment was poorly worded. Without ClojureDocs, my getting started experience may have simply been more frustrating.
I think the issue for me is many of the core methods are overloaded and can do different things given different inputs. In a typed language like Java, these would be separate methods each with a few sentences of documentation (and often an example if the behavior is complicated) in the official JavaDoc. The types also clearly show me the shape of the data I need to pass and the expected return value.
I can't think of a great example but just taking one at random here's the docstring for into.
user=> (doc into) ------------------------- clojure.core/into ([] [to] [to from] [to xform from]) Returns a new coll consisting of to-coll with all of the items of from-coll conjoined. A transducer may be supplied.Just from reading this I would never expect to be able to build a map given a vector of two-elem vectors (key value pairs). But ClojureDocs has a clear example of that:
;; This is ok: (into {} [[:a "a"] [:b "b"]]) ;;=> {:a "a", :b "b"} ;; But this isn't: (into {} ['(:a "a") '(:b "b")]) ;;=> ClassCastException clojure.lang.Keyword cannot be cast to java.util.Map$Entry clojure.lang.ATransientMap.conj (ATransientMap.java:44)I realize the key behavior is in
conjbut the docstring for that also does not make this clear.2
u/alexdmiller Jan 08 '19
I think there's still a lot of open space for
doc(or some add-on) to include additional external documentation. Thanks for the feedback.8
u/stingraycharles Jan 07 '19 edited Jan 07 '19
The examples were a life saver for me, and still are when trying to figure out more complex behaviors.
It would be great if Cognitect could incorporating them into one, but I'm highly skeptical this would ever happen in that way; more realistically, they will add comment functionality to the existing docs and call it a day.
8
Jan 07 '19
Agree that the official API reference pages are too dry and seem to assume prior knowledge at times. Much better to have real examples of API usuage that can be pasted into the REPL. I almost never use https://clojure.org/reference/* but use ClojureDocs all the time.
4
u/foobarbazquix Jan 07 '19
cljdoc.org is another source for documentation driven by the community. It’s extensible and covers libraries too. They recently added Dash Docs support for anyone who uses that. The project is on GitHub and the main author is supportive and welcomes contributors.
8
u/alexdmiller Jan 07 '19
If you took the Clojure survey, and marked “Reference docs” as a priority for making improvements, I would be interested to learn more.
do you mean something other than the docs at https://clojure.org/reference/*? (Like API docstrings?)
do you think existing docs should be improved or new things added. And then I’m interested in learning if there are specific things (if so, an issue at https://github.com/clojure/clojure-site/issues would be best) or if this is something else.
Just trying to understand better when you marked that, what did you have in mind for improvement?