| title | Naming Component |
|---|---|
| audience | developers, maintainers, contributors |
| prerequisites | contributor architecture guide |
| related | ../architecture.md, index.md, policy.md, planning.md, codegen.md |
| status | maintained |
| publication | reviewed |
prik/naming/ owns naming rules shared by policy, planning, printers, and code
generation. It keeps Python-visible names valid and collision-free and creates
deterministic native symbols within target-language constraints. It does not
choose exports, ownership, wrapper support, or emitted syntax.
source spelling + public namespace
-> normalize Python identifier
-> reserve it or add a collision suffix
-> public export name
owner identity + preferred generated name + target rules
-> escape reserved or special names
-> avoid occupied symbols
-> deterministic native symbol
Public names and generated symbols are deliberately separate. Escaping a Python keyword must not rename the underlying Fortran symbol, and a C or Fortran restriction must not change the public Python API.
prik/naming/
├── __init__.py
├── policy.py
└── native_symbols.py
prik.namingre-exports the supported public-name and generated-symbol policy API. Change it only when that package-level API changes.policy.pycontainsnormalize_public_name(),NamingPolicy.reserve_public_name(), andgenerated_symbol(). Change it for normalization, strict-name behavior, namespace collisions, keywords, or target-language rules.native_symbols.pycontainsNativeSymbolNames.compact(). It combines a readable prefix with a hash of the full owner identity under a requested length limit.
NamingPolicy retains public reservations for one construction operation.
NativeSymbolNames is stateless: the same owner, preferred spelling, and
limit always produce the same result.
The policy example shows normalization, a public collision, and one C special method rewrite:
python3 prik/naming/policy.pyNormalized public name: render_value
Collision-safe public name: render_value_2
C destructor symbol: state_drop
The compact-symbol example preserves a readable prefix while using the full owner path for collision resistance:
python3 prik/naming/native_symbols.pyOwner identity: geometry.point.coordinates
Stable native symbol: point_coordinate_d_c2fc5940
Within 27-character limit: True
- Change Python normalization, namespace reservation, or target-language rules
in
policy.py. - Change bounded native helper symbols in
native_symbols.py; treat their spelling as generated ABI when compiled artifacts refer to it.
| Evidence | What it establishes |
|---|---|
| Naming tests | Python keyword handling, strict mode, namespace collisions, language keywords, and special-method rewriting. |
Naming must be deterministic for identical inputs. This component may apply a rule supplied by a target language, but it must never infer semantic policy or emit source text.