Liking cljdoc? Tell your friends :D

koine.host

Which host am I on, and what can it do?

koine's rule is that a seam either works or throws a named error — it never quietly degrades. That is right, but it leaves a caller who WANTS to degrade with no way to ask first, and the obvious workaround is not portable: catching the throw is not the same shape on every host, so a try/catch capability probe is itself host-specific code — exactly what koine exists to prevent.

So the question gets a first-class answer. (supports? :process/spawn) is a compile-time constant per host, and code that can do without a capability can branch on it:

(if (host/supports? :process/spawn)
  (talk-to-mcp-server)
  (fall-back-to-http))

Capabilities are named :namespace/fn, matching where they live. An unknown key answers false rather than throwing — a caller asking about a capability koine has not heard of should take the safe branch, not crash.

Which host am I on, and what can it do?

koine's rule is that a seam either works or throws a named error — it never
quietly degrades. That is right, but it leaves a caller who WANTS to degrade
with no way to ask first, and the obvious workaround is not portable: catching
the throw is not the same shape on every host, so a `try`/`catch` capability
probe is itself host-specific code — exactly what koine exists to prevent.

So the question gets a first-class answer. `(supports? :process/spawn)` is a
compile-time constant per host, and code that can do without a capability can
branch on it:

    (if (host/supports? :process/spawn)
      (talk-to-mcp-server)
      (fall-back-to-http))

Capabilities are named `:namespace/fn`, matching where they live. An unknown
key answers false rather than throwing — a caller asking about a capability
koine has not heard of should take the safe branch, not crash.
raw docstring

capabilitiesclj/s

Everything this host can do, as a set.

Both hosts implement everything today, so this is currently a constant - and it is kept anyway, because it is the honest way to ADD a host: a new runtime declares what it has, and callers that already branch on supports? degrade without a line of change.

Everything this host can do, as a set.

Both hosts implement everything today, so this is currently a constant - and
it is kept anyway, because it is the honest way to ADD a host: a new runtime
declares what it has, and callers that already branch on `supports?` degrade
without a line of change.
sourceraw docstring

idclj/s

This host, as a keyword: :jvm or :cljgo.

This host, as a keyword: :jvm or :cljgo.
sourceraw docstring

supports?clj/s

(supports? capability)

True when this host implements capability (e.g. :process/spawn). An unknown capability is false, never an error.

True when this host implements `capability` (e.g. :process/spawn).
An unknown capability is false, never an error.
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