PtcRunner.Lisp.ProtectedNamespaces (PtcRunner v0.13.0)

Copy Markdown View Source

Single consult point for namespace protection in Capability Prelude V1.

Reserved namespaces are host-owned and may never be declared by a deployment prelude, redefined by user code, or shadowed. V1 reserves exactly: tool, data, budget, and ptc.core (plan §2). The future "catalog" namespace name is deliberately deferred.

Namespace names are string-backed at the host boundary (plan §3, Implementation Notes), so this module operates on binaries.

protected/1 unions the reserved set with a compiled prelude's declared namespaces — the full set of namespace names that user code must not write into. This is the seam later phases (analyzer protected-write rejection) consult.

Summary

Functions

The full protected namespace set: reserved namespaces unioned with the namespaces a compiled prelude declares.

The reserved (host-owned) namespace name set.

Whether name is a reserved host namespace.

Functions

protected(prelude)

@spec protected(PtcRunner.Lisp.Prelude.t() | nil) :: MapSet.t()

The full protected namespace set: reserved namespaces unioned with the namespaces a compiled prelude declares.

Passing nil (no prelude attached) returns just the reserved set.

reserved()

@spec reserved() :: MapSet.t()

The reserved (host-owned) namespace name set.

reserved?(name)

@spec reserved?(String.t() | atom()) :: boolean()

Whether name is a reserved host namespace.

Accepts a binary or an atom; atoms are stringified at the boundary.