Accepted
charm.clj originally exposed its entire public API through a single charm.core namespace that re-exported vars from charm.message, charm.program, charm.style.core, charm.style.overlay, and all component namespaces (charm.components.*). This facade contained ~130 def bindings with no logic of its own.
Problems with this approach:
Naming gymnastics — To avoid clashes in a single namespace, component functions needed prefixes: text-input-value, list-selected-item, timer-timeout, progress-complete?, etc. With direct namespace requires, these become the more natural text-input/value, item-list/selected-item, timer/timeout, progress/complete?.
Maintenance burden — Every new or renamed function in any component required a corresponding update in charm.core. This was a frequent source of drift.
Discoverability — Users couldn't easily tell which namespace a function actually lived in, making source navigation harder.
Unnecessary coupling — Requiring charm.core pulled in every component even when only a few were needed.
Remove charm.core entirely. Users require the namespaces they need directly:
(ns my-app
(:require
[charm.components.list :as item-list]
[charm.components.text-input :as text-input]
[charm.message :as msg]
[charm.program :as program]
[charm.style.core :as style]))
The public API namespaces are:
charm.program — run, run-async, cmd, batch, quit-cmdcharm.message — key-match?, key-press?, window-size?, ctrl?, etc.charm.style.core — style, render, colors, border aliases, layout joinscharm.style.border — border definitions (rounded, normal, thick, etc.)charm.style.overlay — place-overlay, center-overlaycharm.components.* — each component in its own namespacetimer/timeout instead of charm/timer-timeout).charm.core.Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |