clojure / clojure/clojure-site

namespaces-reference: ns vs in-ns

Open
#663 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
259
Forks
275
PR merge metrics
No merged PRs in 30d

Description

Reading https://clojure.org/reference/namespaces I was a bit surprised how it describes setting up a namespace when REPL-ing (first section, third paragraph):

The best way to set up a new namespace at the top of a Clojure source file is to use the ns macro.
...
At the Repl it's best to use in-ns, in which case the new namespace will contain mappings only for the classnames in java.lang. In order to access the names from the clojure.core namespace you must execute (clojure.core/refer 'clojure.core).

What’s the rationale behind the it's best to use in-ns?
However nice to read what ns does behind the scenes to turn a ‘bare’ namespace into something ‘useable’, it’s not something that seems to be better than ns ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the namespaces reference at https://clojure.org/reference/namespaces, especially the first section and third paragraph. Compare the documented uses of ns and in-ns, then clarify the rationale for recommending in-ns at the REPL; done means the wording answers why it is preferred.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.