feat(pbs): add service constants and runtime math integration
This commit is contained in:
@@ -192,7 +192,7 @@ Rules:
|
||||
- A `host` barrel entry must resolve to exactly one top-level `declare host` declaration in module scope.
|
||||
- A `struct` barrel entry governs the visibility of the struct declaration and of all methods declared directly in that struct body.
|
||||
- A `host` barrel entry governs the visibility of the host declaration and of all method signatures declared directly in that host body.
|
||||
- A `service` barrel entry governs the visibility of the service declaration, its canonical singleton value, and all methods declared directly in that service body.
|
||||
- A `service` barrel entry governs the visibility of the service declaration, its canonical singleton value, and all methods and constants declared directly in that service body.
|
||||
- A `global` barrel entry governs visibility of one top-level `declare global` declaration.
|
||||
- Methods declared inside a `struct`, `host`, or `service` are never exported independently through `mod.barrel`.
|
||||
|
||||
@@ -371,18 +371,19 @@ Function types use `Fn(T1, T2) -> R`. Lambdas use `fn [captures](name: Type) ->
|
||||
```ebnf
|
||||
ServiceDecl ::= 'declare' 'service' Identifier ServiceBody
|
||||
ServiceBody ::= '{' ServiceMember* '}'
|
||||
ServiceMember ::= 'fn' Identifier ParamList ReturnAnn? Block
|
||||
ServiceMember ::= 'fn' Identifier ParamList ReturnAnn? Block | ConstDecl
|
||||
// SDK only: an IntrinsicCall-attributed service signature may end in ';'.
|
||||
```
|
||||
|
||||
Rules:
|
||||
|
||||
- `declare service Name { ... }` declares a nominal service type together with its canonical module-owned singleton value `Name`.
|
||||
- A service body contains only method declarations.
|
||||
- A service body contains method declarations and `declare const` members. SDK service intrinsic signatures may terminate with `;`; see [Service constants and runtime math](../../../compiler/pbs/specs/service-constants-and-runtime-math.md).
|
||||
- Service methods have an implicit receiver binding `this` of type `Self` and do not declare `this: Self` explicitly.
|
||||
- Services do not declare fields.
|
||||
- Services do not declare `ctor`.
|
||||
- Services are never constructed with `new`.
|
||||
- Service method visibility follows the `service` entry for that declaration in `mod.barrel`; service methods are never exported independently.
|
||||
- Service method visibility follows the `service` entry for that declaration in `mod.barrel`; service methods and constants are never exported independently.
|
||||
|
||||
### 7.4 Functions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user