Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit 763db2d

Browse files
committed
保持简洁。
1 parent c5aaaa5 commit 763db2d

19 files changed

+2
-423
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "CodeNothing"
3-
version = "0.9.1"
3+
version = "0.9.2"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

README.md

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,75 +2,6 @@
22

33
CodeNothing是世界上最好的语言。
44

5-
## 🎉 v0.9.2 重大更新
6-
7-
### 🚀 完整的面向对象编程支持
8-
9-
CodeNothing 现在支持完整的面向对象编程功能,包括:
10-
11-
#### ✨ 字段赋值功能(全新!)
12-
```codenothing
13-
class Student {
14-
public name : string;
15-
public age : int;
16-
public score : int;
17-
18-
constructor(name : string, age : int, score : int) {
19-
this.name = name;
20-
this.age = age;
21-
this.score = score;
22-
};
23-
24-
public fn getInfo() : string {
25-
return this.name + " (年龄: " + this.age + ", 分数: " + this.score + ")";
26-
};
27-
};
28-
29-
fn main() : int {
30-
student : Student = new Student("小明", 15, 85);
31-
32-
// 🎯 新功能:字段赋值
33-
student.name = "小红"; // 修改姓名
34-
student.age = 16; // 修改年龄
35-
student.score = 92; // 修改分数
36-
37-
// 支持复杂表达式
38-
old_score : int = student.score;
39-
student.score = old_score + 5; // 分数加5
40-
41-
std::println(student.getInfo());
42-
return 0;
43-
};
44-
```
45-
46-
#### 🏗️ 完整的OOP特性
47-
-**类定义和实例化**`class` 关键字定义类,`new` 创建实例
48-
-**字段访问**`object.field` 读取字段值
49-
-**字段修改**`object.field = value` 修改字段值 🆕
50-
-**方法调用**`object.method()` 调用对象方法
51-
-**构造函数**`constructor` 初始化对象状态
52-
-**访问控制**`public`/`private` 访问修饰符
53-
54-
### 🧠 高级特性
55-
56-
#### 🔧 泛型系统基础设施
57-
- 泛型类型管理和实例化
58-
- 类型推断和缓存机制
59-
- 为未来的泛型编程奠定基础
60-
61-
#### 🚀 性能优化
62-
- 本地内存管理器:线程本地内存池
63-
- 循环变量优化:专门的循环内存管理
64-
- 模式匹配JIT编译:实验性JIT优化
65-
- 生命周期分析:智能内存安全检查
66-
67-
### 📚 示例程序
68-
69-
查看 `example/` 目录获取更多示例:
70-
- `oop_simple_test.cn` - 基础面向对象编程
71-
- `basic_field_test.cn` - 字段赋值功能演示
72-
- `comprehensive_field_test.cn` - 复杂字段操作示例
73-
745

756
## 动态库开发
767

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// 简单的字段赋值测试
2+
using lib<io>;
23

34
class Person {
45
public name : string;

0 commit comments

Comments
 (0)