Skip to content

Commit 514081c

Browse files
committed
Clarify function syntax sugar in README
See: #113.
1 parent ff7f1c3 commit 514081c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,13 @@ the supplied keys (and any referenced keys). For example:
158158

159159
#### Initializer functions
160160

161-
Sometimes all that is necessary is `init-key`, particularly if what is being
162-
initiated is all in memory, and we can rely on the garbage collector to clean
163-
up afterwards.
161+
Sometimes all that is necessary is `init-key`, particularly if what is
162+
being initiated is all in memory, and we can rely on the garbage
163+
collector to clean up afterwards.
164164

165-
For this purpose, `init-key` will try to find a function matching the key if
166-
no more specific method is set. For example:
165+
For this purpose, `init-key` will try to find a function with the
166+
**same namespace and name** as the keyword, if no more specific method
167+
is set. For example:
167168

168169
```clojure
169170
(def config
@@ -182,9 +183,9 @@ The `sugared-greet` function is equivalent to the `init-key` method:
182183
(println "Hi" name))
183184
```
184185

185-
Note that the function needs to be in a loaded namespace for `init-key` to find
186-
it. The `integrant.core/load-namespaces` function can be used on a configuration
187-
to load namespaces matching the keys.
186+
Note that the function needs to be in a loaded namespace for `init-key`
187+
to find it. The `integrant.core/load-namespaces` function can be used on
188+
a configuration to load namespaces matching the keys.
188189

189190

190191
### Suspending and resuming

0 commit comments

Comments
 (0)