Qualified names¶
How generated declarations (G.Item, G.read_goal.Outcomes) and the declarations of imported
modules (syntax.lambda:normalize) are named, and how identifier-restricted consumers spell them.
names
¶
Qualified names of declarations and of the declarations they generate.
A QVR declaration may generate further declarations: a deduction G
generates its item family G.Item, its run computation G.run, and,
for a selector read_goal, the outcome family G.read_goal.Outcomes.
A generated declaration is named by its parent's name followed by a dotted
member path, which records the declaration it came from. Identifier members
use the usual qualified notation in source. The generated deduction item
constructors for the two modal categories keep their category symbols.
A declaration of an imported module is named, in the single flat program
that static interpretation of the module graph produces, by its module path
and its name in that module, separated by : (syntax.lambda:normalize).
A root module's own declarations keep their bare names. Source never spells
:, so a flat name identifies its origin.
These helpers are the one place either separator is written, so every producer and consumer of generated names agrees on their spelling.
MEMBER_SEPARATOR
module-attribute
¶
Separates a declaration's name from the member path of what it generates.
MODULE_SEPARATOR
module-attribute
¶
Separates a module path from a declaration name in a flat program.
TARGET_MEMBER_SEPARATOR
module-attribute
¶
How identifier-restricted consumers spell a . between two segments.
TARGET_MODULE_SEPARATOR
module-attribute
¶
How identifier-restricted consumers spell a : between two segments.
TARGET_DRAW_SEPARATOR
module-attribute
¶
How identifier-restricted consumers spell a $ between two segments.
theta$z names the site z of a program drawn under theta.
TARGET_ESCAPE
module-attribute
¶
Opens and closes an escaped run of punctuation in a target identifier.
member_name
¶
The name of a declaration that parent generates.
| PARAMETER | DESCRIPTION |
|---|---|
parent
|
The generating declaration's name, itself possibly qualified.
TYPE:
|
*members
|
The member path below the parent, outermost first.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If no member is given, the parent is empty, or a member is neither a single identifier segment nor a built-in modal category symbol. |
Source code in src/quivers/qiec/names.py
member_prefix
¶
The prefix every name generated below parent starts with.
| PARAMETER | DESCRIPTION |
|---|---|
parent
|
The generating declaration's name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
Source code in src/quivers/qiec/names.py
is_member_of
¶
Whether name is generated below parent.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
A declaration name.
TYPE:
|
parent
|
A candidate generating declaration.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether |
Source code in src/quivers/qiec/names.py
member_path
¶
The member path of name below parent.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
A name generated below
TYPE:
|
parent
|
The generating declaration.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[str, ...]
|
The member segments, outermost first. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Source code in src/quivers/qiec/names.py
deduction_of
¶
The deduction whose elaboration a structural origin lies under.
| PARAMETER | DESCRIPTION |
|---|---|
structural_path
|
A source origin's structural path.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str | None
|
The deduction's name when the path is |
Source code in src/quivers/qiec/names.py
is_generated_by
¶
Whether name is exactly the declaration parent generates.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
A flat-program name.
TYPE:
|
parent
|
The generating declaration's name, in its module or flat.
TYPE:
|
*members
|
The member path below the parent, outermost first.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether |
Source code in src/quivers/qiec/names.py
local_segment
¶
The last segment of a name, without its module or parent.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
A plain, member, or flat-program name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
Source code in src/quivers/qiec/names.py
module_qualified
¶
The flat-program name of a declaration of an imported module.
| PARAMETER | DESCRIPTION |
|---|---|
module_path
|
The dotted module path, e.g.
TYPE:
|
name
|
The declaration's name in its module, possibly a generated member
name such as
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If either part is empty or |
Source code in src/quivers/qiec/names.py
split_module
¶
Split a flat-program name into its module path and its local name.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
A flat-program name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[str | None, str]
|
The module path ( |
Source code in src/quivers/qiec/names.py
source_spelling
¶
How a flat-program name reads in diagnostics.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
A flat-program name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The fully qualified dotted path, |
Source code in src/quivers/qiec/names.py
target_identifier
¶
Spell a qualified name as a plain identifier, injectively.
Transpile targets and PyTorch module names admit only
[A-Za-z_][A-Za-z0-9_]*. A name is read as alternating runs of ASCII
letters and digits, kept as they are, and maximal runs of every other
character, each spelled by where it stands and what it holds:
- between two letter-or-digit runs, a single
_stays_, a.is__, a:is___, and a$is____; - at the start or the end of the name, a run of one to three underscores stays as written;
- any other run is escaped:
_____(five underscores), one code per character (ufor_,dfor.,mfor:,sfor$,landrfor the parentheses,cfor,,efor=,hfor#,afor*,pfor a space,bandkfor the brackets,qfor/,gandtfor>and<,wfor?, andU<hex>Zfor any other character), and_____again.
Every underscore run of the result therefore has a length that says
what it is, so source_name reads the name back and two distinct names
never share a spelling. A one-module program keeps its readable
spellings: G.Item is G__Item, lib.arith:shift is
lib__arith___shift, and theta$z is theta____z.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
A flat-program name, a site address, or any other qualified name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The identifier spelling. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Source code in src/quivers/qiec/names.py
source_name
¶
Read a target identifier back as the qualified name it spells.
The inverse of target_identifier: source_name(target_identifier(n))
is n for every name n it accepts.
| PARAMETER | DESCRIPTION |
|---|---|
identifier
|
An identifier
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The qualified name. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
Source code in src/quivers/qiec/names.py
target_names
¶
The reverse map from target identifiers to the names they spell.
| PARAMETER | DESCRIPTION |
|---|---|
names
|
Qualified names one rendering spells.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, str]
|
Each name's |