Skip to content

Commit bf7f3f3

Browse files
committed
Add code examples for the constant naming guideline
1 parent 44227fe commit bf7f3f3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.adoc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,21 @@ Use `*earmuffs*` for things intended for rebinding (ie. are dynamic).
934934
Don't use a special notation for constants; everything is assumed a constant
935935
unless specified otherwise.
936936

937+
[source,clojure]
938+
----
939+
;; good
940+
(def max-size 10)
941+
942+
;; bad
943+
(def MAX-SIZE 10) ; Java style
944+
(def +max-size+ 10) ; Common Lisp style, global constant
945+
(def *max-size* 10) ; Common Lisp style, global variable
946+
----
947+
948+
NOTE: Famously `*clojure-version*` defies this convention, but you should
949+
treat this naming choice is a historical oddity and not as an example to
950+
follow.
951+
937952
=== Unused Bindings [[naming-unused-bindings]]
938953

939954
Use `+_+` for destructuring targets and formal argument names whose

0 commit comments

Comments
 (0)