-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 修复对被const的值绑定结果进行take的bug
- Loading branch information
Showing
13 changed files
with
353 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "mindustry_logic_bang_lang" | ||
version = "0.14.3" | ||
version = "0.14.4" | ||
edition = "2021" | ||
|
||
authors = ["A4-Tacks <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#** | ||
* 这是0.14.4所添加的新语法, 将会尝试给每个const记录其绑定者, | ||
* 然后可以通过`..`来引用 | ||
* | ||
* 正如ValueBind那章所说, 不要轻易给容易混淆的非匿名量绑定 | ||
* | ||
* 这有什么用呢? 这可以模拟'类型方法' '类型成员'等 | ||
*# | ||
|
||
# 以下一个二维向量的例子 | ||
const Vec2 = ( | ||
take $.X=_0 $.Y=_1; | ||
const $.Add = ( | ||
take Rhs = _0; | ||
take ...X=...X ...Y=...Y; # take | ||
# 为了'简单'的常量求值, 需要先take变成支持的格式 | ||
take X=...X Y=...Y; | ||
take RX=Rhs.X RY=Rhs.Y; | ||
# 需要绑定, 不然只是局部作用域并不是全局作用域 | ||
take ...X = ($ = X + RX;); | ||
take ...Y = ($ = Y + RY;); | ||
); | ||
const $.Print = ( | ||
print ...X","...Y; | ||
); | ||
); | ||
|
||
take V1 = Vec2[2 3]; | ||
take V2 = Vec2[3 4]; | ||
take V1.Add[V2]; | ||
take V1.Print; | ||
printflush message1; | ||
#* | ||
print 5 | ||
print "," | ||
print 7 | ||
printflush message1 | ||
*# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.