Skip to content

Commit

Permalink
some further cleanup on the guide change
Browse files Browse the repository at this point in the history
  • Loading branch information
puredanger committed Aug 3, 2023
1 parent eefd381 commit 17b5879
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions content/guides/learn/namespaces.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ The `:require` clause corresponds to the `require` function which specifies one

The last two parts are all about making names easier to use. While vars can always be referred to by their fully-qualified name, we rarely want to type fully-qualified names in our code. Aliases let us use shorter versions of longer fully-qualified aliases. Refer allows us to use names without a namespace qualifier at all.

In require, namespaces most commonly take one of four forms:
In `require`, namespaces most commonly take one of four forms:

* `clojure.set` - just loads `clojure.set` namespace (if not already loaded)
* `[clojure.set :as set]` - load and create an alias `set` for the namespace `clojure.set`
** This allows you to refer to vars in `set` with for example `set/union` instead of `clojure.set/union`
* `[clojure.set :refer [union intersection]]` - load and refer specific vars into this namespace
** This allows you to use just `union` instead of `clojure.set/union`
* `[company.application.component.user :as-alias user]` - create an alias `user` for the namespace `company.application.component.user` without loading it
** Typically, when using `:as-alias`, the namespace is not a loadable namespace
** This allows you to use a shorthand for a namespace qualifier, e.g. when creating entity maps: `{::user/id 1}`, registering specs: `(s/def ::user/id int?)` or when destructing: `(defn find-by-id [{::user/keys [id]}] ,,,)`
* `[company.application.component.user :as-alias user]` - create an alias `user` for the namespace `company.application.component.user` without loading the namespace
** Typically, when using `:as-alias`, the namespace is being used as a qualifier but is not a loadable namespace
** This allows you to use a shorthand for a namespace qualifier, e.g. when creating maps: `{::user/id 1}`, registering specs: `(s/def ::user/id int?)` or destructuring: `(defn find-by-id [{::user/keys [id]}] ,,,)`

=== Java classes and imports

Expand Down

0 comments on commit 17b5879

Please sign in to comment.