Liking cljdoc? Tell your friends :D

hive-addon.host

Soft resolution of HOST services an addon consumes.

An addon is published to maven; its host is not. A load-time (:require [hive-mcp.x :as y]) therefore makes the published artifact unloadable wherever the host is absent. This namespace is the seam that replaces such a require: the host var is resolved THROUGH THE VAR at call time, and a missing host degrades to a Result instead of a load failure.

Surface: resolve-var symbol -> var | nil, never throws available? symbol -> boolean soft symbol -> fn, the per-call seam defsoft def a soft fn at a call site api {k symbol} -> {k soft-fn}, a var-map of them

JVM only (.clj): requiring-resolve has no ClojureScript counterpart, and the host boundary this covers is a JVM boundary.

Soft resolution of HOST services an addon consumes.

An addon is published to maven; its host is not. A load-time
`(:require [hive-mcp.x :as y])` therefore makes the published artifact
unloadable wherever the host is absent. This namespace is the seam that
replaces such a require: the host var is resolved THROUGH THE VAR at call
time, and a missing host degrades to a Result instead of a load failure.

Surface:
  resolve-var  symbol -> var | nil, never throws
  available?   symbol -> boolean
  soft         symbol -> fn, the per-call seam
  defsoft      def a soft fn at a call site
  api          {k symbol} -> {k soft-fn}, a var-map of them

JVM only (.clj): `requiring-resolve` has no ClojureScript counterpart, and
the host boundary this covers is a JVM boundary.
raw docstring

apiclj

(api spec)

Build a var-map of soft fns from {k sym} or {k [sym absent-fn]}.

The map is the whole host surface one addon namespace consumes, in one place; every value obeys soft's contract.

Build a var-map of soft fns from `{k sym}` or `{k [sym absent-fn]}`.

The map is the whole host surface one addon namespace consumes, in one
place; every value obeys `soft`'s contract.
sourceraw docstring

available?clj

(available? sym)

True when sym resolves to a var right now.

True when `sym` resolves to a var right now.
sourceraw docstring

declared-symbolsclj

(declared-symbols ns-sym)

Every host symbol declared by defsoft in namespace ns-sym, as {var-name host-symbol}. The namespace must already be loaded.

Every host symbol declared by `defsoft` in namespace `ns-sym`, as
{var-name host-symbol}. The namespace must already be loaded.
sourceraw docstring

defsoftcljmacro

(defsoft name sym & {:keys [absent doc]})

Def name as the soft fn for host symbol sym.

sym is evaluated, so quote it: (defsoft edges 'hive-mcp.kg/edges). Options: :absent, a fn called with the same args when the host is absent; :doc, a docstring.

The var carries the host symbol as :host/sym metadata, so a suite can enumerate what a namespace claims of its host and check every one of them resolves. Without that check a misspelled host symbol is indistinguishable from an absent host: it degrades quietly instead of failing to compile.

Def `name` as the soft fn for host symbol `sym`.

`sym` is evaluated, so quote it: (defsoft edges 'hive-mcp.kg/edges).
Options: `:absent`, a fn called with the same args when the host is absent;
`:doc`, a docstring.

The var carries the host symbol as `:host/sym` metadata, so a suite can
enumerate what a namespace claims of its host and check every one of them
resolves. Without that check a misspelled host symbol is indistinguishable
from an absent host: it degrades quietly instead of failing to compile.
sourceraw docstring

resolve-varclj

(resolve-var sym)

Resolve sym (a fully-qualified symbol) to its var, or nil.

Never throws: an absent namespace, a namespace that fails to load, and a namespace that loads without defining the name all return nil.

Resolve `sym` (a fully-qualified symbol) to its var, or nil.

Never throws: an absent namespace, a namespace that fails to load, and a
namespace that loads without defining the name all return nil.
sourceraw docstring

softclj

(soft sym)
(soft sym absent-fn)

Return a variadic fn standing in for the host fn named by sym.

Each call resolves sym and, on success, invokes the VAR, so a host that loads after the addon is picked up and a host namespace reload is seen by the next call. A successful resolution is cached; an unsuccessful one is not, so absence never becomes permanent.

When the host is absent the call returns (r/err :host/absent {:host/sym <sym-string>}), or, given absent-fn, (apply absent-fn args).

Return a variadic fn standing in for the host fn named by `sym`.

Each call resolves `sym` and, on success, invokes the VAR, so a host that
loads after the addon is picked up and a host namespace reload is seen by
the next call. A successful resolution is cached; an unsuccessful one is
not, so absence never becomes permanent.

When the host is absent the call returns
`(r/err :host/absent {:host/sym <sym-string>})`, or, given `absent-fn`,
`(apply absent-fn args)`.
sourceraw docstring

unresolvableclj

(unresolvable ns-syms)

Of the host symbols defsoft declared across ns-syms, those that do NOT resolve right now, as {var-symbol host-symbol}.

With the host on the classpath this must be empty: a symbol left over from a host rename, or mistyped, would otherwise degrade silently forever.

Of the host symbols `defsoft` declared across `ns-syms`, those that do NOT
resolve right now, as {var-symbol host-symbol}.

With the host on the classpath this must be empty: a symbol left over from a
host rename, or mistyped, would otherwise degrade silently forever.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close