practicalli / practicalli/clojure
Namespaces - require
Nobody has claimed this yet.
- Dominant language
- Makefile
- Stars
- 117
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
require loads a namespace (if it isn't already loaded) and can give the namespace a local alias (:as) and can also intern symbols from that namespace into the current namespace (so they are accessible without the alias) -- using :refer. refer itself does the same as require's :refer option -- but does not load the namespace first. refer-clojure is a shorthand for (refer 'clojure.core )
It's very rare to use the refer function since you normally need to load a namespace before first use, and it's easier to combine the require and refer operations in a single require with the :refer option.
refer-clojure is generally only needed when you are deliberately defining symbols in your namespace that "shadow" something in clojure.core and want to avoid the warning the compiler gives about replacing symbol definitions.
For example, https://github.com/clojure/clojure/blob/master/src/clj/clojure/string.clj#L42 -- since clojure.string defines replace and reverse that shadow (hide/replace) those two definitions in clojure.core.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the issue text and the referenced example in src/clj/clojure/string.clj around line 42. Determine where this explanation of require, refer, and refer-clojure belongs; done means the relevant documentation clearly covers namespace loading, aliases, symbol interning, and shadowing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100