implements PLN-0008

This commit is contained in:
2026-03-27 18:23:20 +00:00
parent d28916578b
commit b75b2a5825
19 changed files with 444 additions and 18 deletions
@@ -207,6 +207,13 @@ At minimum, the PBS diagnostics baseline must cover:
- a stable warning when a materialized value is produced and then ignored,
- and no warning for unit-like expression statements.
Reserved-attribute diagnostics for host-backed asset lowering must also cover:
- duplicate `AssetLowering` declarations on the same host signature,
- missing or malformed `AssetLowering(param = N)` arguments,
- out-of-range `AssetLowering.param` indexes,
- and `AssetLowering` targets whose selected parameter is not statically typed as `Addressable`.
At minimum, host-admission diagnostics must cover missing or malformed host capability metadata and unknown or undeclared capability names.
Only backend-originated failures that remain source-attributable and user-actionable belong to the PBS-facing diagnostics contract.
@@ -185,6 +185,7 @@ When available at this boundary, declared host ABI shape (`arg_slots`, `ret_slot
When a host-backed callsite also depends on backend-owned symbolic asset lowering:
- the frontend boundary MUST preserve which callsite argument is asset-facing;
- for PBS v1 this asset-facing designation is carried by reserved host metadata `[AssetLowering(param = N)]`;
- the preserved symbolic operand MUST remain attributable to a backend-provided `Addressable` identity;
- backend stages MUST be able to rewrite that symbolic operand into runtime-facing `asset_id` before the final low-level host path is emitted.
@@ -80,14 +80,19 @@ Rules:
- Attributes are not first-class values and are not reflectable in v1 core.
- Attributes do not automatically survive into runtime or bytecode artifacts.
- An attribute affects runtime artifacts only when another specification defines an explicit lowering for its semantic effect.
- In v1 core, the normative reserved attributes are `Host`, `Capability`, `BuiltinType`, `BuiltinConst`, `IntrinsicCall`, `Init`, `Frame`, and `InitAllowed`.
- In v1 core, the normative reserved attributes are `Host`, `Capability`, `AssetLowering`, `BuiltinType`, `BuiltinConst`, `IntrinsicCall`, `Init`, `Frame`, and `InitAllowed`.
- `Host` is valid only on a host method signature declared directly inside a reserved stdlib/interface-module `declare host` body.
- `Capability` is valid only on a host method signature declared directly inside a reserved stdlib/interface-module `declare host` body.
- `AssetLowering` is valid only on a host method signature declared directly inside a reserved stdlib/interface-module `declare host` body.
- `Init` is valid only on a top-level userland `fn` declaration with lifecycle-admissible signature.
- `Frame` is valid only on a top-level userland `fn` declaration with lifecycle-admissible signature.
- `InitAllowed` is valid only on a host method signature declared directly inside a reserved stdlib/interface-module `declare host` body.
- `Host` is invalid on ordinary user-authored modules, top-level `fn`, struct methods, service methods, callbacks, contracts, and constants.
- `Host` metadata is consumed by the compiler during host-binding lowering.
- `AssetLowering` MUST declare exactly the named argument `param`.
- `AssetLowering.param` MUST be a zero-based integer literal that names a valid host parameter position.
- The parameter targeted by `AssetLowering.param` MUST be statically typed as `Addressable`.
- `AssetLowering` metadata is consumed by backend-owned host-call lowering to rewrite the targeted symbolic `Addressable` operand into runtime-facing `asset_id`.
- The `Host` attribute syntax itself is not exported as runtime metadata; instead, its canonical identity participates in PBX host-binding emission as defined by the Host ABI Binding specification.
- `BuiltinType` is valid only on a reserved top-level `declare builtin type` declaration.
- `BuiltinConst` is valid only on a reserved top-level `declare const` declaration that omits an initializer.
@@ -143,7 +143,8 @@ For example, the PBS-facing declaration:
declare host LowAssets {
[Host(module = "asset", name = "load", version = 1)]
[Capability(name = "asset")]
fn load(asset_id: int, slot: int) -> (status: int, loading_handle: int);
[AssetLowering(param = 0)]
fn load(addressable: Addressable, slot: int) -> (status: int, loading_handle: int);
}
```
@@ -155,6 +156,8 @@ maps to the canonical runtime identity:
The loader MUST NOT derive runtime identity from the source owner spelling `LowAssets`.
At the PBS-facing declaration layer, `AssetLowering(param = 0)` marks the author-facing `Addressable` parameter as the backend-owned symbolic operand that must be rewritten to operational `asset_id` before the final low-level host path is emitted.
## 7. PBX Host Binding Section
### 7.1 Temporary section contract
@@ -214,7 +214,8 @@ or:
declare host LowAssets {
[Host(module = "asset", name = "load", version = 1)]
[Capability(name = "asset")]
fn load(asset_id: int, slot: int) -> (status: int, loading_handle: int);
[AssetLowering(param = 0)]
fn load(addressable: Addressable, slot: int) -> (status: int, loading_handle: int);
}
```
@@ -228,8 +229,8 @@ Rules:
- stdlib line `1` MUST expose the low-level asset interface module at `@sdk:asset`,
- that module MUST declare `LowAssets`,
- that module MUST use runtime module `asset` and capability `asset`,
- that module MUST use the runtime-aligned signatures:
- `load(asset_id: int, slot: int) -> (status: int, loading_handle: int)`
- that module MUST use the runtime-aligned signatures and reserved lowering metadata:
- `load(addressable: Addressable, slot: int) -> (status: int, loading_handle: int)` together with `[AssetLowering(param = 0)]`
- `status(loading_handle: int) -> int`
- `commit(loading_handle: int) -> int`
- `cancel(loading_handle: int) -> int`