feat(stdlib): format all value types and expose handle identity members
- Add read-only FunctionRef.module/name and PluginHandle.plugin/export members; PluginHandle.id stays private (ADR-0029). - Extend stdlib/format.mq.md to Formula/Code/FunctionRef/PluginHandle/ Memory/Resource/Unit, with UTF-8 byte length for Code. - Fix two-digit ordered-list body indentation so arms 10+ stay inside their branch (they were previously top-level statements). - Extend stdlib demo to Formula/Code/FunctionRef and assert all three io.写值/打印 pairs match byte-for-byte. - Add runtime member observation test, ADR-0029, spec/status/changelog/evidence. Gate: fmt, clippy -D warnings, 416 tests passed.
This commit is contained in:
1 parent
1377af1601
commit
e119727c5d
14 files changed
+334
-15
No files matched your search
+62
-4
@@ -1,10 +1,44 @@
|
||||
## 字节长度
|
||||
|
||||
`(文本)`
|
||||
|
||||
**点 = text.codepoints(文本)**
|
||||
|
||||
**总字节 = 0**
|
||||
|
||||
**下标 = 0**
|
||||
|
||||
- `下标 < 长度(点)`
|
||||
|
||||
**码点 = 点[下标]**
|
||||
|
||||
1. `码点 < 128`
|
||||
|
||||
**总字节 = 总字节 + 1**
|
||||
|
||||
2. `码点 < 2048`
|
||||
|
||||
**总字节 = 总字节 + 2**
|
||||
|
||||
3. `码点 < 65536`
|
||||
|
||||
**总字节 = 总字节 + 3**
|
||||
|
||||
4. `true`
|
||||
|
||||
**总字节 = 总字节 + 4**
|
||||
|
||||
**下标 = 下标 + 1**
|
||||
|
||||
*总字节*
|
||||
|
||||
## 显示
|
||||
|
||||
`(值)`
|
||||
|
||||
按语言值语义格式化,用于与内置 `打印` 的输出对照。
|
||||
当前只覆盖 Unit/None/Bool/Int/Float/Text/List/Map/Table;Formula/Code/
|
||||
FunctionRef/PluginHandle 仍缺少公开观察接口。
|
||||
覆盖 Unit/None/Bool/Int/Float/Text/List/Map/Table/Formula/Code/
|
||||
FunctionRef/PluginHandle/Memory/Resource。
|
||||
|
||||
**类别 = 类型(值)**
|
||||
|
||||
@@ -32,9 +66,33 @@ FunctionRef/PluginHandle 仍缺少公开观察接口。
|
||||
|
||||
*表格显示(值)*
|
||||
|
||||
7. `true`
|
||||
7. `类别 == "Formula"`
|
||||
|
||||
*文本(值)*
|
||||
*"Formula(" + 转义文本(值.latex) + ")"*
|
||||
|
||||
8. `类别 == "Code"`
|
||||
|
||||
*"Code(" + 转义文本(值.language) + ", " + 文本(字节长度(值.source)) + " bytes)"*
|
||||
|
||||
9. `类别 == "FunctionRef"`
|
||||
|
||||
*"FunctionRef(" + 值.module + "::" + 值.name + ")"*
|
||||
|
||||
10. `类别 == "PluginHandle"`
|
||||
|
||||
*"PluginHandle(" + 值.plugin + "::" + 值.export + ")"*
|
||||
|
||||
11. `类别 == "Memory"`
|
||||
|
||||
*"Memory"*
|
||||
|
||||
12. `类别 == "Resource"`
|
||||
|
||||
*"Resource"*
|
||||
|
||||
13. `true`
|
||||
|
||||
*文本(值)*
|
||||
|
||||
## 列表显示
|
||||
|
||||
|
||||
Reference in new issue
Block a user