Identifiers¶
Stable identifiers distinguish declarations independently of their display names, and provenance records the source location each came from. Together they link diagnostics and generated computations back to source, and let one name recur in different scopes without making the declarations identical.
identifiers
¶
Stable identifiers and source provenance for the QIEC kernel.
Identifiers in the kernel are content-derived references, not process-local object identities. This keeps the serialized core independent of Python objects and gives migrations a stable target when source locations move.
QIEC_ABI
module-attribute
¶
The kernel ABI tag a module records, so a reader can reject a module built against another kernel.
AddressRelation
¶
How an effect request relates to its source site.
"preserve" marks the request as written; "split" and
"duplicate" mark a request a handler derived from it; "eliminate"
marks one a handler discharged.
StableId
didactic-model
¶
Bases: Model
A namespaced, SHA-256-derived kernel identifier.
The human-readable declaration name is intentionally not stored in the
identifier. Renaming display labels must not silently alter equality;
callers choose the declaration path supplied to :meth:derive and record
renames explicitly in a migration map.
| PARAMETER | DESCRIPTION |
|---|---|
digest
|
The 64-character lowercase hex SHA-256 digest; usually produced by
:meth:
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If the digest is not 64 lowercase hexadecimal characters. |
derive
classmethod
¶
Derive an identifier from the values that determine it.
| PARAMETER | DESCRIPTION |
|---|---|
parts
|
The determining values, in order. Order matters, so two identifiers built from the same values differently arranged are distinct.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Self
|
The derived identifier. The ABI version and the namespace are mixed in, so an identifier from one namespace can never equal one from another, and a future ABI change re-derives rather than silently reusing. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If a part has no canonical encoding. |
Source code in src/quivers/qiec/identifiers.py
parse
classmethod
¶
Read an identifier back from its wire form.
| PARAMETER | DESCRIPTION |
|---|---|
text
|
The wire form,
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Self
|
The parsed identifier. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the text carries another namespace's prefix, or the remainder is not a valid digest. Parsing is namespace-checked so a handler identifier cannot be read as an effect one. |
Source code in src/quivers/qiec/identifiers.py
__lt__
¶
__lt__(other: StableId) -> bool
Order identifiers by digest within the same concrete namespace.
| PARAMETER | DESCRIPTION |
|---|---|
other
|
The identifier to compare.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether this digest precedes the other, or NotImplemented for identifiers of different classes. |
Source code in src/quivers/qiec/identifiers.py
__str__
¶
The wire form of this identifier.
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
to_data
¶
Return the stable wire representation.
| RETURNS | DESCRIPTION |
|---|---|
str
|
The same string as |
FamilyId
didactic-model
¶
ConstructorId
didactic-model
¶
EffectId
didactic-model
¶
OperationId
didactic-model
¶
EffectInstanceId
didactic-model
¶
ComputationId
didactic-model
¶
AttachmentId
didactic-model
¶
EqualityId
didactic-model
¶
StaticScopeId
didactic-model
¶
StaticVariableId
didactic-model
¶
RowVariableId
didactic-model
¶
PrimitiveId
didactic-model
¶
DistributionId
didactic-model
¶
SourceOrigin
didactic-model
¶
SourceOrigin(*, module: str, structural_path: tuple[str | int, ...] = field(opaque=True, extras=OPAQUE_BY_VALUE), role: str, source_protocol: str, file: str | None = None, line: int | None = None, column: int | None = None)
Bases: QiecModel
Stable structural source origin with optional diagnostic coordinates.
structural_path is the protocol path after parsing and name
resolution. Line and column are diagnostic metadata and therefore do not
participate in :meth:site_id.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The module the site belongs to.
TYPE:
|
structural_path
|
The path of names and positions from the module root to the site.
TYPE:
|
role
|
What the site is, such as
TYPE:
|
source_protocol
|
The source language or protocol the path is expressed in.
TYPE:
|
file
|
The file the site was read from, if any.
TYPE:
|
line
|
The one-based line of the site, if known.
TYPE:
|
column
|
The one-based column of the site, if known.
TYPE:
|
site_id
¶
site_id() -> SiteId
The stable identity of the source site this origin describes.
| RETURNS | DESCRIPTION |
|---|---|
SiteId
|
An identity derived from the protocol, module, structural path, and role. The file, line, and column are deliberately excluded, so reformatting a source file does not change the identity of the sites within it. |
Source code in src/quivers/qiec/identifiers.py
to_data
¶
Return the serializable form of this origin.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
Every field, including the diagnostic coordinates. Those do
not enter |
Source code in src/quivers/qiec/identifiers.py
DynamicAddressFrame
didactic-model
¶
Bases: QiecModel
One serializable component of a dynamic effect address.
| PARAMETER | DESCRIPTION |
|---|---|
scope
|
What kind of frame this is, such as a call, a handler clause, a resumption, or a local instance.
TYPE:
|
key
|
The frame's position within its scope: a name or an ordinal.
TYPE:
|
SiteProvenance
didactic-model
¶
SiteProvenance(*, origin: SourceOrigin = field(opaque=True, extras=OPAQUE_BY_VALUE), dynamic_path: tuple[DynamicAddressFrame, ...] = field(default=(), opaque=True, extras=OPAQUE_BY_VALUE), resumption_path: tuple[int, ...] = field(default=(), opaque=True, extras=OPAQUE_BY_VALUE), relation: AddressRelation = field(default='preserve', opaque=True, extras=OPAQUE_BY_VALUE), parents: tuple[SiteId, ...] = field(default=(), opaque=True, extras=OPAQUE_BY_VALUE))
Bases: QiecModel
Static and dynamic provenance of an effect request.
| PARAMETER | DESCRIPTION |
|---|---|
origin
|
The source site the request was written at.
TYPE:
|
dynamic_path
|
The address frames entered to reach this occurrence of the site, outermost first. A handler-clause frame left by discharge is relative to the active caller's dynamic path.
TYPE:
|
resumption_path
|
The ordinal of each resumption taken to reach this occurrence, so a site reached twice under a multi-shot handler yields two keys.
TYPE:
|
relation
|
How this request relates to the source site:
TYPE:
|
parents
|
The static sites a derived request was generated from.
TYPE:
|
static_site
property
¶
static_site: SiteId
The source site this request was written at.
| RETURNS | DESCRIPTION |
|---|---|
SiteId
|
The static identity, shared by every dynamic occurrence of the request. |
dynamic_key
¶
A hashable key distinguishing occurrences of one static site.
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, tuple[tuple[str, str | int], ...], tuple[int, ...]]
|
The static site, the dynamic address frames, and the resumption path. One site reached twice, under a loop or under a resumed continuation, yields two keys, which is what lets a trace name each occurrence separately. |
Source code in src/quivers/qiec/identifiers.py
to_data
¶
Return the serializable form of this provenance.
| RETURNS | DESCRIPTION |
|---|---|
dict[str, object]
|
The origin, the static site, and the dynamic address. The static site is written out alongside the origin it derives from so a reader need not re-derive it. |