Document workspace ownership, resource semantics and agent lifecycle

This commit is contained in:
2026-10-09 18:06:25 +08:00
parent f7526ab2a0
commit 52f497671e
31 changed files with 748 additions and 232 deletions
+7 -8
View File
@@ -23,22 +23,22 @@ return discountedPrice(amount, 5)
下面采用本书的函数语法提案,展示成功调用的结果依赖。跨 namespace 引用采用目标函数可见、名称无冲突的条件。
代码归属:`alice:shop.pricing`。函数声明:
代码归属:`atelier:shop.pricing`。函数声明:
```endorphin
function discountedPrice(price: Int, discount: Int): Int {
function discountedPrice(price: Number, discount: Number): Number {
return price - discount
}
```
该函数从 price 中扣除 discount,并返回整数结果。
该函数从 price 中扣除 discount,并返回数值结果;Number 沿用第 7 章的统一数值类型名提案。
代码归属:`bob:shop.checkout`。导入与调用方声明:
代码归属:`market:shop.checkout`。导入与调用方声明:
```endorphin
use alice:shop.pricing
use atelier:shop.pricing
function payable(price: Int, discount: Int): Int {
function payable(price: Number, discount: Number): Number {
let amount = discountedPrice(price, discount)
return discountedPrice(amount, 5)
}
@@ -53,7 +53,7 @@ function payable(price: Int, discount: Int): Int {
第二次调用使用第一次的结果。因此,在 amount 的成功结果可用前,后续调用不能把它当作已取得的值使用。上述语义在 inflight 中体现;Preflight 检查调用目标、参数和返回类型等可静态判断的约束。
这里展示成功路径。失败、缺失、未就绪的具体处理语法仍按规范状态记录,不能将它们当作整数 0。仅凭这段数据依赖也不能推出所有函数参数的求值顺序。
这里展示成功路径。失败、缺失、未就绪的具体处理语法仍按规范状态记录,不能将它们当作数值 0。仅凭这段数据依赖也不能推出所有函数参数的求值顺序。
## 反向验证
@@ -66,4 +66,3 @@ function payable(price: Int, discount: Int): Int {
DOC-004、009、010、011、013、015。代码、说明和结果表共同承担上下文与解释;不要求每个项目都单独显示一段“规则检查”。
[对应任务](../tasks/TASK-04.md) · [示例目录](README.md)