Multiline or protocol docstrings can be easily formatted:
(defn foo "Does a very complicated thing that I need to explain in excruciating detail. Firstly, this function stringifies x with the standard greeting of 'Hello'. Secondly, it appends the necessary exclamation point to the resulting string. Finally, it prints the resulting result to *out*, followed by a newline and the appropriate flush." [x] (println (str "Hello, " x "!"))) (defprotocol Bar "A retail business establishment that serves alcoholic beverages, such as beer, wine, liquor, cocktails, and other beverages like mineral water and soft drinks and often sells snack foods, like crisps or peanuts, for consumption on premises.")
But what about this inevitable combination of two: protocol methods? Should they just spill onto the next line with a two-position indent?
(defprotocol Baz (qux [thing2 thing1] "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."))
It looks good in code, but if I call (doc qux) I get
------------------------- user/qux ([thing2 thing1]) Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
and now the first line looks rather strange. This is the only option that does not cause Emacs Mq to work against you, so something like this will not fly:
(defprotocol Baz (qux [thing2 thing1] "Lorem ipsum dolor sit amet, consectetur adipiscing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."))
And even if it did not break autoformat, it looks strange to me.
So should I refuse? Should I use very short docstrings for protocol methods and maybe just include more complete documentation in the main protocol docstring?
(defprotocol Baz "Lorem ipsum dolor sit amet, consectetur adipiscing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." (qux [thing2 thing1] "Does a thing to thing1 depending on thing2."))
Or is there a better way?