ecs/xcap
src/ecs/xcap.tur
per-(World, Component) linear capability tokens.
Since: X1
defopaque
XWriteCap
(XWriteCap [W T] :int)
linear capability proving the holder may write
Since: X1
defopaque
XReadCap
(XReadCap [W T] :int))
non-linear capability proving the holder may read
Since: X1
defn
make-write-cap
(make-write-cap [W T])
mint a fresh write capability for component T in
Parameters
| cid | the component's CID within world W (or a placeholder where | |
| unused). The CID is world-local: the same component may | ||
| carry CID 0 in two different worlds without collision, | ||
| because the conflict key is the (World, CID) pair. |
Returns
A `^linear` `XWriteCap<W, T>`. The parameters W and T are inferred from the call-site's expected type or ascription.
Example
(let [cap (:: (make-write-cap 0) (XWriteCap RenderWorld RenderPos))]
(use-cap! cap))
Since: X1
defn
make-read-cap
(make-read-cap [W T])
mint a fresh read capability for component T in
Parameters
| cid | the component's world-local CID (or a placeholder). |
Returns
A `XReadCap<W, T>` (non-linear).
Since: X1
defn
use-cap!
(use-cap! [W T])
consume a linear write capability.
Parameters
| cap | a `^linear XWriteCap<W, T>` (consumed) |
Since: X1