Identifiers¶
Stable identifiers and source provenance for the kernel.
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
dataclass
¶
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:
|
__post_init__
¶
Reject a digest that is not 64 lowercase hex characters.
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the digest is the wrong length or contains a character
outside |
Source code in src/quivers/qiec/identifiers.py
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
__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
dataclass
¶
ConstructorId
dataclass
¶
OperationId
dataclass
¶
EffectInstanceId
dataclass
¶
ComputationId
dataclass
¶
AttachmentId
dataclass
¶
EqualityId
dataclass
¶
StaticScopeId
dataclass
¶
StaticVariableId
dataclass
¶
RowVariableId
dataclass
¶
PrimitiveId
dataclass
¶
DistributionId
dataclass
¶
SourceOrigin
dataclass
¶
SourceOrigin(module: str, structural_path: tuple[str | int, ...], role: str, source_protocol: str, file: str | None = None, line: int | None = None, column: int | None = None)
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
dataclass
¶
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
dataclass
¶
SiteProvenance(origin: SourceOrigin, dynamic_path: tuple[DynamicAddressFrame, ...] = (), resumption_path: tuple[int, ...] = (), relation: AddressRelation = 'preserve', parents: tuple[SiteId, ...] = ())
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.
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. |