Object → Method Call:WSaiOS-SI 中方法调用的结构运行理论
作者:东塬一老翁
单位:WSaiOS 多模态智能
日期:2026 年 10 月
摘要
本文基于 WSaiOS-SI 中 Class、Object、Attribute、Value、Method 等基本理论,系统讨论“方法调用”的结构地位与运行机制。本文的核心主张是:Method 不是脱离 Object 独立运行的抽象行为,而是定义于 Class、通过具体 Object 上的 Method Call 进入实例运行环境,并在该 Object 的 Attribute、Value、State、Relation、Rule 与 Context 条件下触发 Operation 的可执行结构。由此,WSaiOS-SI 方法调用理论的核心关系不是“Class → Method”,而是“Object → Method Call”。本文严格区分 Method、Method Call 与 Operation,建立方法调用的组成模型、形式化模型、状态转换模型与结构验证模型,并讨论其与 Attribute、Value、Rule、Context、Relation、状态历史、反馈学习、知识结构与能力结构之间的关系。本文进一步指出,方法调用不是传统意义上的简单函数调用,而是对象结构进入动态运行状态的基本入口。在 WSaiOS-SI 的自主语义理解框架下,Object、Method、Parameter 与调用结构可以由系统自身识别和验证,大型语言模型并非该过程的必要组成部分。
关键词: WSaiOS-SI;方法调用;Object;Method;结构运行;自主语义理解;状态转换;结构智能
---
1. 引言
在面向对象理论中,Class 定义一类对象的共同结构、属性、方法、关系与规则,Object 则是 Class 实例化后形成的具体对象实例。Attribute 是 Object 的结构成员,Value 是 Attribute 当前对应的具体值或状态,Method 则是 Class 中定义的可调用运算结构。至此,一个关键问题随之产生:
Class 中定义的 Method 如何真正作用于具体 Object?
如果 Method 只停留在 Class 定义层面,那么它仍然只是抽象的可调用结构。只有当 Method 被绑定到某个具体 Object,并在该 Object 的当前状态、参数、上下文、规则和关系条件下执行时,它才会产生实际结果。因此,本文提出并论证:
Object \rightarrow Method\ Call \rightarrow Operation \rightarrow Result
如果方法改变对象内部状态,则形成:
Object \rightarrow Method\ Call \rightarrow Operation \rightarrow Value\ Change \rightarrow State\ Change
本文的目的,是在 WSaiOS-SI 框架下建立一套关于方法调用的结构运行理论。该理论不把方法调用理解为简单的名称匹配或函数执行,而是把它理解为 Object 与 Method 之间的运行关系,是对象结构进入动态运行状态的基本入口。
---
2. 问题提出:从 Class 定义到 Object 运行
Class 定义 Method,例如:
```text
Class Product
Method sell(quantity)
```
这里,sell(quantity) 是 Method 定义。它说明 Product 这类对象具有卖出商品的能力,但并未说明“谁卖出”“卖出多少”“当前库存是多少”“是否允许卖出”。
真正进入运行时,必须出现:
```text
ProductA.sell(3)
```
此时,系统才能确定:
· Object = ProductA
· Method = sell
· Parameter = 3
· 当前库存 = ProductA.inventory
· 操作 = inventory - 3
· 结果 = ProductA.inventory 更新
因此:
Method \neq Method\ Call
Method 是定义,Method Call 是调用行为。Method 解决“对象能够执行什么”,Method Call 解决“哪个具体 Object 现在执行这个 Method”,Operation 解决“这个 Method 在这个 Object 上实际执行了什么运算”。
所以,方法调用理论必须完成从 Class 定义到 Object 运行的过渡:
Class \rightarrow Method\ Definition \rightarrow Object \rightarrow Method\ Call \rightarrow Operation
---
3. Method、Method Call 与 Operation 的区分
3.1 Method 是 Class 层面的定义
Method 通常由 Class 定义。例如:
```text
Class Product
Attribute
price
inventory
Method
sell()
restock()
calculateTotal()
```
其中,sell()、restock()、calculateTotal() 属于 Product 类层面的共同方法定义。它们描述 Product 对象能够执行的行为结构。
3.2 Method Call 是 Object 层面的运行
Method 定义本身不会产生具体实例结果。只有通过 Object 调用,Method 才进入运行环境:
```text
ProductA.sell(3)
```
此时,Object 是 ProductA,Method 是 sell,Parameter 是 3。Method Call 建立了 Object 与 Method 之间的运行关系。
3.3 Operation 是实际执行的运算
Operation 是 Method Call 在具体 Object 上实际执行的运算。例如:
```text
ProductA.inventory = 50
ProductA.sell(3)
Operation: 50 - 3 = 47
```
因此,三者关系可以表示为:
Method = 可调用运算结构的定义
Method\ Call = 将 Method 绑定到具体 Object 并触发运行的过程
Operation = Method\ Call 实际执行的运算
---
4. Object 是方法调用的具体载体
Method 虽然定义在 Class 中,但它不能仅凭 Class 定义产生某一个具体实例的运行结果。例如:
```text
ProductA.inventory = 50
ProductB.inventory = 10
```
当调用:
```text
ProductA.sell(3)
```
系统读取:
```text
ProductA.inventory = 50
```
执行:
```text
50 - 3 = 47
```
得到:
```text
ProductA.inventory = 47
```
而调用:
```text
ProductB.sell(3)
```
系统读取:
```text
ProductB.inventory = 10
```
执行:
```text
10 - 3 = 7
```
得到:
```text
ProductB.inventory = 7
```
由此可见:
同一个\ Method + 不同\ Object + 不同\ Value \rightarrow 不同\ Operation\ Result
这证明 Object 是 Method 进入具体实例运行环境的载体。Method 提供共同运算结构,Object 提供具体运行对象。
---
5. 方法调用的基本结构与组成
方法调用的最基本结构可以表示为:
Object \rightarrow Method\ Call \rightarrow Method \rightarrow Operation \rightarrow Result
更完整地说,一个 Method Call 至少包括:
```text
Method Call
├── Object
├── Method
├── Parameters
├── Context
├── Preconditions
├── Operation
├── Result
├── Effects
└── Postconditions
```
其中:
· Object 确定谁执行这个 Method;
· Method 确定执行什么行为;
· Parameters 确定本次调用提供什么输入;
· Context 确定在什么上下文中执行;
· Preconditions 确定什么条件下允许执行;
· Operation 确定实际执行什么运算;
· Result 确定运算产生什么结果;
· Effects 确定 Object 的 Value、State、Relation 或 Structure 发生什么变化;
· Postconditions 确定执行完成以后必须满足什么条件。
因此:
Method\ Call = Object + Method + Parameters + Context + Conditions + Operation + Result + Effects
---
6. 方法调用的形式化模型
定义 Object:
O = \langle I_o, C, A, V, S, R, Q \rangle
其中:
· I_o:对象标识;
· C:所属 Class;
· A:Attribute 集合;
· V:Attribute Value 映射;
· S:当前状态;
· R:关系集合;
· Q:规则集合。
定义 Method:
M = \langle I_m, P, Pre, Op, Out, Eff, Rule, Context \rangle
其中:
· I_m:Method 标识;
· P:参数集合;
· Pre:前置条件;
· Op:操作结构;
· Out:输出;
· Eff:效果;
· Rule:规则约束;
· Context:上下文要求。
定义 Method Call:
Call = Invoke(O, M, P, Context)
执行过程为:
Precondition(O, M, P, Context) = True
则:
Operation(O, M, P) \rightarrow Result
并产生:
S_2 = Transition(S_1, Call)
如果:
Precondition(O, M, P, Context) = False
则:
Call \rightarrow Failed
因此,调用结果可以表示为:
CallResult = \{Success, Failure, Result, StateChange, RelationChange, StructureChange\}
这一形式化模型说明,方法调用不是简单函数调用,而是受对象状态、参数、上下文和规则约束的结构运行过程。
---
7. 方法调用的类型
Method Call 对 Object 的影响范围可以不同。至少存在三类:
7.1 读取型调用
```text
ProductA.getPrice()
```
如果 price = 100,Method 只读取 Value 并返回 100。此时:
Object \rightarrow Method\ Call \rightarrow Read \rightarrow Result
Object 状态没有变化。
7.2 状态改变型调用
```text
ProductA.sell(3)
```
执行:
```text
inventory = inventory - 3
```
形成:
State_1 \rightarrow Method\ Call \rightarrow Operation \rightarrow State_2
7.3 结构改变型调用
```text
OrderA.generateInvoice()
```
可能创建 Invoice 对象,并建立 Order 与 Invoice 之间的关系:
Object \rightarrow Method\ Call \rightarrow Operation \rightarrow Relation\ Change \rightarrow Structure\ Change
因此,Method Call 的结果可以是 Value、Object、Structure、状态变化、关系变化或结构变化。
---
8. 方法调用与条件、规则和上下文
Method 执行并不一定无条件进行。例如:
```text
ProductA.inventory = 2
ProductA.sell(5)
```
如果规则为:
```text
inventory >= quantity
```
则:
2 \geq 5 = False
Method Call 不能正常执行。Object 状态不应错误地变成:
```text
inventory = -3
```
除非 Class Rule 明确允许这种状态。
因此:
Precondition \rightarrow Rule\ Validation \rightarrow Method\ Call \rightarrow Operation
同一个 Method 在不同 Context 中也可能产生不同结果。例如:
```text
ProductA.calculatePrice()
```
在 Retail 上下文中可能使用零售价,在 Wholesale 上下文中可能使用批发价。因此:
Method\ Call = Object + Method + Parameters + Context
方法调用不能完全脱离上下文。
---
9. 方法调用与对象状态、关系和结构
Method Call 最重要的作用之一,是改变 Object 状态:
State_1 \rightarrow Method\ Call \rightarrow Operation \rightarrow State_2
例如:
```text
ProductA.inventory = 50
ProductA.sell(3)
inventory: 50 → 47
```
Method Call 也可以改变 Relation。例如:
```text
OrderA.pay()
```
执行前:
```text
OrderA.status = unpaid
```
执行后:
```text
OrderA.status = paid
```
并可能进一步改变:
```text
OrderA → can_ship → ShippingProcess
```
因此:
Method\ Call \rightarrow Value\ Change \rightarrow State\ Change \rightarrow Relation\ Change \rightarrow Structure\ Change
某些 Method Call 还会产生新的结构。例如:
```text
OrderA.generateInvoice()
```
调用后创建 InvoiceA,于是形成:
Order\ Structure + Invoice\ Structure + Relation \rightarrow Billing\ Structure
这说明 Method Call 不仅是状态修改机制,也是新 Object、新 Relation 和新 Structure 形成的触发机制。
---
10. 方法调用的事件性质与状态历史
一次 Method Call 可以被视为一个结构事件:
```text
Method Call Event
├── Object
├── Method
├── Parameters
├── Time
├── Context
├── Initial State
├── Operation
├── Result
└── Final State
```
例如:
```text
ProductA.sell(3)
Object = ProductA
Method = sell
Parameter = 3
Initial inventory = 50
Operation = inventory - 3
Result = success
Final inventory = 47
```
因此,Method Call 不仅产生 Result,也可以形成 Object State Transition 的可追踪结构。多次调用形成状态历史:
```text
10:00 inventory = 50
11:00 inventory = 47
12:00 inventory = 42
```
方法调用因此成为 Object 生命周期和 State History 的一部分。
---
11. 方法调用的嵌套、组合与对象交互
一个 Method 可以调用另一个 Method。例如:
```text
OrderA.checkout()
validate()
calculateTotal()
pay()
generateInvoice()
```
形成 Method Call Chain:
M_1 \rightarrow M_2 \rightarrow M_3 \rightarrow M_4
多个 Method Call 可以组合成更高层的 Operation Structure:
Method\ Call_1 + Method\ Call_2 + Method\ Call_3 + Relation \rightarrow Composite\ Method\ Operation
不同 Object 也可以互相调用 Method:
```text
CustomerA.placeOrder()
OrderA.calculate()
ProductA.checkInventory()
InventoryA
```
于是形成动态的 Object Interaction Structure。方法调用因此不仅是 Object 内部运行机制,也是 Object 之间动态结构关系形成的重要机制。
---
12. 与 PHP 面向对象逻辑的对应
PHP 面向对象逻辑可以清晰体现上述理论:
```php
class Product {
public $inventory;
public function sell($quantity) {
$this->inventory -= $quantity;
}
}
```
实例化:
```php
$productA = new Product();
$productB = new Product();
```
不同实例:
```text
ProductA.inventory = 50
ProductB.inventory = 10
```
分别调用:
```php
$productA->sell(3);
$productB->sell(3);
```
结果:
```text
ProductA.inventory = 47
ProductB.inventory = 7
```
这里最重要的理论关系是:
Class \rightarrow Method\ Definition \rightarrow Object \rightarrow Method\ Call \rightarrow Operation \rightarrow Object\ State\ Change
PHP 的 $productA->sell(3) 可以作为“Object → Method Call”这一理论关系的具体实现例子。但 WSaiOS-SI 研究的不是 PHP 语法本身,而是其背后的结构关系:Method 属于 Class 定义,Method Call 属于 Object 运行,Operation 属于实际执行。
---
13. 方法重用、多态与继承
同一个 Method 可以被多个 Object 调用:
```text
ProductA.sell()
ProductB.sell()
ProductC.sell()
```
因此:
One\ Method\ Definition \rightarrow Multiple\ Object\ Calls
但每次调用的 Object State 可能不同,因此:
Same\ Method + Different\ Object\ State \rightarrow Different\ Execution\ Result
这正是 Class 与 Object 结构复用能力的重要体现。
当不同 Class 具有相同 Method 语义时,不同 Object 可以分别执行自己的 Method 实现。例如:
```text
Animal.speak()
Dog.speak()
Cat.speak()
```
调用:
```text
DogA.speak()
CatA.speak()
```
虽然 Method Name 相同,但 Method Structure 可以不同。因此:
Object \rightarrow Method\ Call \rightarrow Resolve\ Method\ Structure \rightarrow Execute
如果存在继承:
```text
Parent Class → Child Class
```
子类继承父类 Method:
```text
Parent Method → Inherited Method → Child Object → Method Call
```
Method Call 还可能执行继承方法或被重写方法。因此,方法调用涉及 Class Hierarchy 与 Method Resolution,是结构解析与运行过程,而不是简单名称执行。
---
14. 自主语义理解与方法调用识别
在 WSaiOS-SI 中,Method Call 必须经过系统自身的自主语义理解。例如输入:
```text
“让产品 A 卖出 3 件。”
```
系统不能简单依赖文字模式识别,而需要识别:
```text
Object = ProductA
Action / Method = sell
Parameter = 3
Target Attribute = inventory
Operation = inventory - 3
Expected State Change = inventory decrease
```
形成:
```text
Object → Method → Parameter → Method Call Structure
```
然后执行:
Invoke(ProductA, sell, 3)
因此:
原始信息 \rightarrow 自主语义理解 \rightarrow Object识别 \rightarrow Method识别 \rightarrow Parameter识别 \rightarrow Method\ Call\ Structure \rightarrow Validation \rightarrow Operation
大型语言模型不是这一过程的必要组成部分。如果系统使用外部 LLM,其结果仍必须经过:
LLM\ Output \rightarrow 自主语义理解 \rightarrow Semantic\ Validation \rightarrow Object / Method / Parameter \rightarrow Method\ Call
才能进入结构运行。这保证了 WSaiOS-SI 在方法调用识别与执行上的自主性。
---
15. 方法调用与结构智能闭环
方法调用最终进入完整的结构智能闭环:
```text
需求
↓
结构匹配
↓
选择 Object
↓
选择 Method
↓
Method Call
↓
Operation
↓
Result
↓
Object State Change
↓
Structure Change
↓
Decision
↓
Execution
↓
Feedback
↓
Learning
↓
Method / Structure Optimization
```
如果执行结果不符合需求:
```text
Feedback
↓
Method Call Analysis
↓
Object State Analysis
↓
Structure Analysis
↓
Method / Rule / Relation Adjustment
↓
New Method Call
```
由此形成循环:
Call \rightarrow Result \rightarrow Feedback \rightarrow Learning \rightarrow Reorganization \rightarrow New\ Call
因此,WSaiOS-SI 中的学习不仅可以学习 Value,也可以学习:
· 哪个 Method 适合哪个 Object;
· 什么条件下调用 Method;
· Method 调用顺序;
· Method 之间的依赖;
· Method 产生什么结果;
· Method 如何改变 State;
· Method 如何影响 Relation;
· Method 如何形成新 Structure。
学习的对象因此不仅是数据,还包括对象如何通过 Method 进行结构运行。
---
16. 方法调用的基本原则
综合本文,可以建立以下方法调用原则:
1. Object 绑定原则:Method Call 必须绑定具体 Object。
2. Class 定义原则:Method 由 Class 定义或继承。
3. 调用原则:Method 只有通过 Call 才能进入具体实例运行。
4. 实例状态原则:Method Call 必须基于 Object 当前实例状态运行。
5. Attribute 访问原则:Method 可以访问 Object 的 Attribute。
6. Value 运算原则:Method 可以获取 Attribute Value 并参与运算。
7. Parameter 原则:Method Call 可以携带具体 Parameters。
8. Condition 原则:Method Call 受到 Condition 约束。
9. Rule 原则:Method Call 受到 Class Rule 和 Object 运行规则约束。
10. Operation 原则:Method Call 必须能够映射到实际 Operation。
11. Result 原则:Method Call 可以产生 Value、Object、Structure、状态或其他结果。
12. 状态转移原则:Method Call 可以使 Object 从 State₁ 进入 State₂。
13. Relation 变化原则:Method Call 可以导致 Object Relation 发生变化。
14. Structure 变化原则:Method Call 可以导致 Structure 发生变化或产生新 Structure。
15. 组合原则:多个 Method Call 可以组合成为更高层 Operation Structure。
16. 可重用原则:同一个 Method 可以被多个 Object 调用。
17. 实例差异原则:同一个 Method 作用于不同 Object 时,可以因为 Object State 不同而产生不同结果。
18. 验证原则:Method Call 必须经过 Object、Parameter、State、Rule 和 Operation 验证。
19. 反馈原则:Method Call 的执行结果可以进入 Feedback。
20. 自主语义原则:Method Call 的 Object、Method、Parameter 和语义关系必须能够由 WSaiOS-SI 自身自主语义理解和验证,不依赖 LLM 作为最终语义依据。
---
17. 结论
本文建立了 WSaiOS-SI 中方法调用的核心理论关系:
Object \rightarrow Method\ Call
并进一步建立:
Class \rightarrow Method\ Definition \rightarrow Object \rightarrow Method\ Call \rightarrow Operation \rightarrow Result \rightarrow Value\ Change \rightarrow State\ Change \rightarrow Relation\ Change \rightarrow Structure\ Change
其中最核心的理论区分为:
· Method = 可调用运算结构的定义;
· Method Call = 将 Method 绑定到具体 Object 并触发运行的过程;
· Operation = Method Call 实际执行的运算;
· Result = Operation 产生的结果;
· State Change = Operation 对 Object 实例状态产生的变化。
因此,Method 不是独立运行的结构。Method 属于 Class 定义,只有通过具体 Object 上的 Method Call,才能进入实例运行环境。Object 提供具体运行对象,Method 提供共同运算结构,Method Call 建立 Object 与 Method 之间的运行关系,Operation 完成实际运算,Result 体现运算结果,而 Value 和 State 的变化体现 Method Call 对 Object 产生的实际结构影响。
最终形成:
Class \rightarrow Method \rightarrow Object \rightarrow Method\ Call \rightarrow Operation \rightarrow Result \rightarrow Value / State \rightarrow Relation \rightarrow Structure \rightarrow Knowledge \rightarrow Capability \rightarrow Cognition \rightarrow Decision \rightarrow Execution \rightarrow Feedback \rightarrow Learning \rightarrow Evolution
因此,Object → Method Call 是 WSaiOS-SI 对象结构进入动态运行状态的基本入口。在整个结构智能体系中,方法调用并不是普通的程序调用概念,而是:
一个以 Object 为具体运行主体、以 Method 为运算结构定义、以 Attribute Value 为运算对象、以 Rule 和 Condition 为约束、以 Operation 为执行过程、以 Result 和 State Transition 为结果的结构运行机制。
同时,在 WSaiOS-SI 的自主语义理解框架下:
原始信息 \rightarrow 自主语义理解 \rightarrow Object识别 \rightarrow Method识别 \rightarrow Parameter识别 \rightarrow Method\ Call\ Structure \rightarrow 结构验证 \rightarrow Operation \rightarrow Result
因此,方法调用理论完全可以在不依赖大型语言模型的情况下独立成立和运行。这为 WSaiOS-SI 后续研究 $this、对象自身状态、方法多态、继承解析、对象交互网络与结构智能运行闭环提供了理论基础。
---
参考文献
[1] WSaiOS 研究. 第四卷:Class、Object、Attribute、Value、Method 理论.
[2] WSaiOS 研究. 第五卷 第二章:对象实例状态.
[3] WSaiOS 研究. 第五卷 第三章:方法调用.
[4] WSaiOS 研究. 第五卷 第四章:$this 与对象自身状态.