practicalli / practicalli/clojure

Clojure syntax: defn- and ^:private

Open
#280 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clojure-core
Dominant language
Makefile
Stars
117
Forks
36
PR merge metrics
No merged PRs in 30d

Description

Making the distinction between pubiic and private has less importance in Clojure projects from an access point of view. Private vars can be accessed outside of their namespace scope using #'

There is value in highlighting which parts of a namespace represents the API of that namespace, to help developers use the right level of abstractions when working with that code (either as a library or as part of the project)

Its simply a matter of style as to which syntax should be used. Ideally the same syntax should be used throughout the project.

^:private is more explicit expression of the intent of the code.

http://blog.danieljanus.pl/2012/04/25/how-to-call-a-private-function-in-clojure/

https://github.com/bbatsov/clojure-style-guide/issues/124

defn- is here to stay
Other var defining functions will not get a macro that provides a private version.

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

No file, test, or entry point is named. Start by reading the issue and the linked Clojure style-guide discussion, then inspect the repository's existing guidance on defn- and ^:private; done would require an agreed, consistently documented convention.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.