Skip to content

Commit 3e4ce90

Browse files
committed
Merge pull request bbatsov#107 from marknsikora/multimethod
Add a rule for defmethod [fixes bbatsov#106]
2 parents c083c24 + a42c407 commit 3e4ce90

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,31 @@ when there are no arguments on the same line as the function name.
165165
[x] (bar x))
166166
```
167167

168+
* <a name="multimethod-dispatch-val-placement"></a>
169+
Place the `dispatch-val` of a multimethod on the same line as the
170+
function name.
171+
<sup>[[link](#multimethod-dispatch-val-placement)]</sup>
172+
173+
174+
```Clojure
175+
;; good
176+
(defmethod foo :bar [x] (baz x))
177+
178+
(defmethod foo :bar
179+
[x]
180+
(baz x))
181+
182+
;; bad
183+
(defmethod foo
184+
:bar
185+
[x]
186+
(baz x))
187+
188+
(defmethod foo
189+
:bar [x]
190+
(baz x))
191+
```
192+
168193
* <a name="docstring-after-fn-name"></a>
169194
When adding a docstring – especially to a function using the above form – take
170195
care to correctly place the docstring after the function name, not after the

0 commit comments

Comments
 (0)