Skip to content

Commit

Permalink
导出类型
Browse files Browse the repository at this point in the history
属性公开性
  • Loading branch information
Bylx666 committed Feb 13, 2024
1 parent 4ac89b3 commit 3400560
Show file tree
Hide file tree
Showing 17 changed files with 963 additions and 832 deletions.
17 changes: 4 additions & 13 deletions samples/helloworld.ks
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,8 @@
a // corruption
}`/

class Test {
> a:Func
> new():Test {
c: 20
},
> .pubmet();
b
>c
d
.met() {}
}
let p = Test::new()
mod D:\code\rs\key-lang\samples\testmod.ks> mym
let s = mym-:MyStruct::new();
log(s)
mym-:MyStruct::d(s);

log(p)
12 changes: 9 additions & 3 deletions samples/testmod.ks
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
let tt = "hhhh"
mod.test() {
log(tt);
mod:MyStruct {
>a
b
.d(){log("ok")}
>new():MyStruct {
b:20
}
}
}
let s = MyStruct::new()
}
18 changes: 18 additions & 0 deletions spec/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,24 @@ class MyClass {
}
MyClass::new().get_a() == "a"

## 模块化

mod: MyClass {
...
}

只有\>前缀的成员才能被模块外访问。使用class而不是mod:时,>前缀无意义。
```
mod other.ks> mymod
class A = mymod-:MyClass
my_mod-:MyClass::some()
let some = my_mod-:MyClass::some;
some();
```

## obj

希望能和js的Object玩起来手感差不多
Expand Down
Loading

0 comments on commit 3400560

Please sign in to comment.