Skip to content

Setting default namespace not required  #179

@practicalli-johnny

Description

@practicalli-johnny

Article title
Setting default namespace not required

Article description or content
Define all the reasons that setting a user namespace for the Clojure REPl is simply not required

  • editor evaluation of code automatically sets the relevant namespace to evaluate code

    • no need to use require and in-ns
  • custom user namespace can be defined in dev/user.clj and an alias used to add dev directory to the classpath

    • issues starting the repl with the custom user namespace can be avoided by not including the alias that adds dev directory to the classpath, then user is not loaded.

Setting the namespace is not a feature that is officially supported by the Clojure team

There are hacks for Leiningen and Clojure CLI although each is tool specific.

A custom user namespace works regardless of tool as it is Clojure code. This also means a custom repl startup config is pretty standard

It's

A good article would include

  • an introduction to the subject to be covered and why its valuable
  • detailed description of the subject, including lots of examples (code, screenshots, videos, etc).
  • a summary of the lessons learned in the article

Creative Commons license
All ideas and content submitted will be used for any Practicalli content under a Creative Commons license and will be freely available
L

Metadata

Metadata

Assignees

No one assigned

    Labels

    articleNew article topics and suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions