diff --git a/doc/zh_TW/API/consts.md b/doc/zh_TW/API/consts.md index 735fca38..05440468 100644 --- a/doc/zh_TW/API/consts.md +++ b/doc/zh_TW/API/consts.md @@ -1,5 +1,7 @@ # 內置常量 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/consts.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/consts.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + ## True ## False diff --git a/doc/zh_TW/API/funcs.md b/doc/zh_TW/API/funcs.md index 691715f6..a66a7555 100644 --- a/doc/zh_TW/API/funcs.md +++ b/doc/zh_TW/API/funcs.md @@ -1,5 +1,7 @@ # 功能 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/funcs.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/funcs.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ## 基本功能 ### if|T; U|(cond: Bool, then: T, else: U) -> T or U diff --git a/doc/zh_TW/API/index.md b/doc/zh_TW/API/index.md index e69de29b..77223195 100644 --- a/doc/zh_TW/API/index.md +++ b/doc/zh_TW/API/index.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/index.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/index.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/API/modules/external/alstruct.md b/doc/zh_TW/API/modules/external/alstruct.md index 94e932f2..ff5b14f4 100644 --- a/doc/zh_TW/API/modules/external/alstruct.md +++ b/doc/zh_TW/API/modules/external/alstruct.md @@ -1,5 +1,7 @@ # 結構 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/modules/external/alstruct.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/modules/external/alstruct.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 模塊為它們提供代表代數結構和補丁的特征 * 成員 diff --git a/doc/zh_TW/API/modules/repl.md b/doc/zh_TW/API/modules/repl.md index 8a1018b3..8f13c939 100644 --- a/doc/zh_TW/API/modules/repl.md +++ b/doc/zh_TW/API/modules/repl.md @@ -1,5 +1,7 @@ # 模塊`repl` +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/modules/repl.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/modules/repl.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 提供REPL(Read-Eval-Print-Loop)相關的API。 ## 功能 diff --git a/doc/zh_TW/API/modules/status.md b/doc/zh_TW/API/modules/status.md index ca082199..77ebb0e8 100644 --- a/doc/zh_TW/API/modules/status.md +++ b/doc/zh_TW/API/modules/status.md @@ -1,5 +1,7 @@ # 模塊`status` +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/modules/status.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/modules/status.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 定義了一個類型來表示狀態。請根據情況刪除選項來使用它 * ExecResult = {"success", "warning", "failure", "fatal", "unknown"} diff --git a/doc/zh_TW/API/modules/unit.md b/doc/zh_TW/API/modules/unit.md index a4bccd20..6c3e4b95 100644 --- a/doc/zh_TW/API/modules/unit.md +++ b/doc/zh_TW/API/modules/unit.md @@ -1,5 +1,7 @@ # 模塊`unit` +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/modules/unit.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/modules/unit.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + `unit` 模塊是將數值計算中經常使用的單位定義為類型的模塊。 Erg 數值類型包括 `Nat`、`Int`、`Ratio` 等。但是,這些類型沒有關于“數字的含義”的信息,因此可以執行諸如添加米和碼之類的無意義計算。 通過使用 `unit` 模塊,您可以避免錯誤,例如將不同單位的數字傳遞給函數。 diff --git a/doc/zh_TW/API/modules/unsound.md b/doc/zh_TW/API/modules/unsound.md index a5febad2..1a896545 100644 --- a/doc/zh_TW/API/modules/unsound.md +++ b/doc/zh_TW/API/modules/unsound.md @@ -1,5 +1,7 @@ # 模塊 `unsound` +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/modules/unsound.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/modules/unsound.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 讓 API 執行在 Erg 的類型系統中無法保證的不健全和不安全的操作。 ## `unsafe!` diff --git a/doc/zh_TW/API/operators.md b/doc/zh_TW/API/operators.md index ce91831c..7ddcbeca 100644 --- a/doc/zh_TW/API/operators.md +++ b/doc/zh_TW/API/operators.md @@ -1,5 +1,7 @@ # 操作員 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/operators.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/operators.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + ## 中綴運算符 ### `_+_`|R; O; A <: Add(R, O)|(x: A, y: R) -> O diff --git a/doc/zh_TW/API/procs.md b/doc/zh_TW/API/procs.md index 38e3e3a0..c1ffdb32 100644 --- a/doc/zh_TW/API/procs.md +++ b/doc/zh_TW/API/procs.md @@ -1,5 +1,7 @@ # 過程 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/procs.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/procs.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ## print! ```python diff --git a/doc/zh_TW/API/special.md b/doc/zh_TW/API/special.md index ff4c4157..d67578bc 100644 --- a/doc/zh_TW/API/special.md +++ b/doc/zh_TW/API/special.md @@ -1,5 +1,7 @@ # 特殊形式 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/special.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/special.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 特殊形式是不能在 Erg 類型系統中表達的運算符、子程序(等等)。它被`包圍,但實際上無法捕獲。 此外,為方便起見,還出現了“Pattern”、“Body”和“Conv”等類型,但不存在此類類型。它的含義也取決于上下文。 diff --git a/doc/zh_TW/API/types.md b/doc/zh_TW/API/types.md index c8750872..c6ef3225 100644 --- a/doc/zh_TW/API/types.md +++ b/doc/zh_TW/API/types.md @@ -1,5 +1,7 @@ # 內置 Erg 類型列表 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 類型本身的屬性不存儲在 `.__dict__` 中,不能從實例中引用 ## 基本類型 diff --git a/doc/zh_TW/API/types/classes/Array!(T).md b/doc/zh_TW/API/types/classes/Array!(T).md index 3d683634..264c3d17 100644 --- a/doc/zh_TW/API/types/classes/Array!(T).md +++ b/doc/zh_TW/API/types/classes/Array!(T).md @@ -1,3 +1,5 @@ # Array! T +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Array!(T).md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Array!(T).md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 表示可變長度數組的類型。在編譯時長度未知時使用。 有一個語法糖叫做` [t]!`。在`Array! T = ArrayWithMutLength! T, !_`中被定義 \ No newline at end of file diff --git a/doc/zh_TW/API/types/classes/Array(T).md b/doc/zh_TW/API/types/classes/Array(T).md index 54011ea8..f2bfc5f0 100644 --- a/doc/zh_TW/API/types/classes/Array(T).md +++ b/doc/zh_TW/API/types/classes/Array(T).md @@ -1,3 +1,5 @@ # Array T: Type +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Array(T).md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Array(T).md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 由`Array T = ArrayWithLen T, _`定義。 有一種語法糖叫做`[T]`。 \ No newline at end of file diff --git a/doc/zh_TW/API/types/classes/ArrayWithLen(T,N).md b/doc/zh_TW/API/types/classes/ArrayWithLen(T,N).md index 6e7eaa7c..671a95fd 100644 --- a/doc/zh_TW/API/types/classes/ArrayWithLen(T,N).md +++ b/doc/zh_TW/API/types/classes/ArrayWithLen(T,N).md @@ -1,5 +1,7 @@ # ArrayWithLen T: Type, N: Nat +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/ArrayWithLen(T,N).md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/ArrayWithLen(T,N).md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + `[T; N]`是語法糖。還有一個[`Array` 類型](./Array.md)省略了長度。 ## 方法 diff --git a/doc/zh_TW/API/types/classes/ArrayWithMutLength!(T,N).md b/doc/zh_TW/API/types/classes/ArrayWithMutLength!(T,N).md index b4704e32..9301585d 100644 --- a/doc/zh_TW/API/types/classes/ArrayWithMutLength!(T,N).md +++ b/doc/zh_TW/API/types/classes/ArrayWithMutLength!(T,N).md @@ -1,5 +1,7 @@ # ArrayWithMutLength! T: Type, N: Nat! +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/ArrayWithMutLength!(T,N).md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/ArrayWithMutLength!(T,N).md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 一個可變長度數組,其長度在編譯時已知。還有語法糖`ArrayWithMutLength(T, !N) == [T; !N]` ## 方法 diff --git a/doc/zh_TW/API/types/classes/Class.md b/doc/zh_TW/API/types/classes/Class.md index e69de29b..8cad7741 100644 --- a/doc/zh_TW/API/types/classes/Class.md +++ b/doc/zh_TW/API/types/classes/Class.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Class.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Class.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/API/types/classes/Complex.md b/doc/zh_TW/API/types/classes/Complex.md index c3dd5521..bc783294 100644 --- a/doc/zh_TW/API/types/classes/Complex.md +++ b/doc/zh_TW/API/types/classes/Complex.md @@ -1,5 +1,7 @@ # Complex +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Complex.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Complex.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 表示復數的類型。在 Erg 中表示數字的類型,例如 Float、Int和Nat,通常派生于Complex ## 父類 diff --git a/doc/zh_TW/API/types/classes/Dict!.md b/doc/zh_TW/API/types/classes/Dict!.md index 1b7ae72c..95950ea7 100644 --- a/doc/zh_TW/API/types/classes/Dict!.md +++ b/doc/zh_TW/API/types/classes/Dict!.md @@ -1,5 +1,7 @@ # Dict! K, V +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Dict!.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Dict!.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 表示字典(哈希Map)的類型。 有一個語法糖叫做`{K: V}` ## 方法 diff --git a/doc/zh_TW/API/types/classes/Either.md b/doc/zh_TW/API/types/classes/Either.md index fd7e11ff..38517463 100644 --- a/doc/zh_TW/API/types/classes/Either.md +++ b/doc/zh_TW/API/types/classes/Either.md @@ -1,5 +1,7 @@ # Either L, R = L or R +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Either.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Either.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 表示L或R的類型。 您可以將其視為Or類型的二元形式 ## 方法 diff --git a/doc/zh_TW/API/types/classes/Float.md b/doc/zh_TW/API/types/classes/Float.md index 8e64241a..77a3ee9d 100644 --- a/doc/zh_TW/API/types/classes/Float.md +++ b/doc/zh_TW/API/types/classes/Float.md @@ -1,5 +1,7 @@ # Float size +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Float.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Float.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 表示實數(包含小數的數)的類型。符合IEEE 754的浮點數,在其他語言中一般是float的類型。 Float的大小為8(1byte)~128(16byte)。如果只是Float,則表示`Float64`。 Erg 中的 0.1 實際上屬于 Ratio 類型,而不是 Float 類型。沒有浮點類型字面量,它是由 `(Ratio object)f64` 生成的(例如 (1/2)f64, 15f64)。 f64 對應實數 1 diff --git a/doc/zh_TW/API/types/classes/Function(N).md b/doc/zh_TW/API/types/classes/Function(N).md index 4317a8ea..08d6b7b0 100644 --- a/doc/zh_TW/API/types/classes/Function(N).md +++ b/doc/zh_TW/API/types/classes/Function(N).md @@ -1,5 +1,7 @@ # Function N: Nat +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Function(N).md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Function(N).md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ## Function 1 的方法 * then(self, g: Self) -> Self diff --git a/doc/zh_TW/API/types/classes/Inf.md b/doc/zh_TW/API/types/classes/Inf.md index bbdabfe0..685cf242 100644 --- a/doc/zh_TW/API/types/classes/Inf.md +++ b/doc/zh_TW/API/types/classes/Inf.md @@ -1,5 +1,7 @@ # Inf +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Inf.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Inf.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + Inf是一個類,其唯一實例是inf。 inf的主要用途是用于區間類型。 例如,大于等于 2 的整數類型是 `2.. Type ``` diff --git a/doc/zh_TW/API/types/classes/Matrix.md b/doc/zh_TW/API/types/classes/Matrix.md index b653846d..06acac62 100644 --- a/doc/zh_TW/API/types/classes/Matrix.md +++ b/doc/zh_TW/API/types/classes/Matrix.md @@ -1,5 +1,7 @@ # Matrix T: Num, Shape: [M, N] +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Matrix.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Matrix.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 表示矩陣的類型。 它繼承自 Tensor[M, N] ## 定義 diff --git a/doc/zh_TW/API/types/classes/Module.md b/doc/zh_TW/API/types/classes/Module.md index 547f7253..135a64da 100644 --- a/doc/zh_TW/API/types/classes/Module.md +++ b/doc/zh_TW/API/types/classes/Module.md @@ -1,3 +1,5 @@ # Module +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Module.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Module.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + ## 方法 diff --git a/doc/zh_TW/API/types/classes/Nat.md b/doc/zh_TW/API/types/classes/Nat.md index e02e9db6..1fe9da24 100644 --- a/doc/zh_TW/API/types/classes/Nat.md +++ b/doc/zh_TW/API/types/classes/Nat.md @@ -1,5 +1,7 @@ # Nat +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Nat.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Nat.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 表示自然數的類型。 用于數組索引和范圍類型 ## 定義 diff --git a/doc/zh_TW/API/types/classes/Neg.md b/doc/zh_TW/API/types/classes/Neg.md index ef25b01d..5317a2bd 100644 --- a/doc/zh_TW/API/types/classes/Neg.md +++ b/doc/zh_TW/API/types/classes/Neg.md @@ -1,5 +1,7 @@ # Neg +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Neg.md%26commit_hash%3D290c43b09f7c3036112a164bed5fd07a1f6a5cda)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Neg.md&commit_hash=290c43b09f7c3036112a164bed5fd07a1f6a5cda) + 表示負整數的類型。 Pos和Neg和{0} == Int 它還具有一些值得注意的屬性,例如不被零除和 Neg * Neg == Pos diff --git a/doc/zh_TW/API/types/classes/Never.md b/doc/zh_TW/API/types/classes/Never.md index c2288573..00dcf7f1 100644 --- a/doc/zh_TW/API/types/classes/Never.md +++ b/doc/zh_TW/API/types/classes/Never.md @@ -1,5 +1,7 @@ # Never +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Never.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Never.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 它是所有類型的子類型。 它是一個`Class`,因為它擁有所有的方法,當然還有 `.new`。但是,它沒有實例,并且Erg會在即將創建的那一刻停止。 還有一種叫做`Panic`的類型沒有實例,但是`Never`用于正常終止或故意無限循環,`Panic`用于異常終止。 diff --git a/doc/zh_TW/API/types/classes/NonZero.md b/doc/zh_TW/API/types/classes/NonZero.md index 2dc71d41..c4b9e526 100644 --- a/doc/zh_TW/API/types/classes/NonZero.md +++ b/doc/zh_TW/API/types/classes/NonZero.md @@ -1,5 +1,7 @@ # NonZero N +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/NonZero.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/NonZero.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 表示非零數的類。 保證除零的安全性 ```mermaid diff --git a/doc/zh_TW/API/types/classes/Object.md b/doc/zh_TW/API/types/classes/Object.md index 62740f79..ea27c461 100644 --- a/doc/zh_TW/API/types/classes/Object.md +++ b/doc/zh_TW/API/types/classes/Object.md @@ -1,5 +1,7 @@ # Object +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Object.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Object.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 它是所有類型的超類型 ## 方法 diff --git a/doc/zh_TW/API/types/classes/Operator.md b/doc/zh_TW/API/types/classes/Operator.md index 0d40c2d7..363d3bd1 100644 --- a/doc/zh_TW/API/types/classes/Operator.md +++ b/doc/zh_TW/API/types/classes/Operator.md @@ -1,5 +1,7 @@ # Operator [...T], O +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Operator.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Operator.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 是運算符的類型 ## 定義 diff --git a/doc/zh_TW/API/types/classes/Option.md b/doc/zh_TW/API/types/classes/Option.md index 979f8d25..dd14db2a 100644 --- a/doc/zh_TW/API/types/classes/Option.md +++ b/doc/zh_TW/API/types/classes/Option.md @@ -1,5 +1,7 @@ # Option T = T or NoneType +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Option.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Option.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 表示“可能失敗”的類型。 ## 方法 diff --git a/doc/zh_TW/API/types/classes/Pos.md b/doc/zh_TW/API/types/classes/Pos.md index 42edd789..02881a92 100644 --- a/doc/zh_TW/API/types/classes/Pos.md +++ b/doc/zh_TW/API/types/classes/Pos.md @@ -1,5 +1,7 @@ # Pos +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Pos.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Pos.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + Pos是一種表示正數(大于或等于1的整數)的類型。 由于不包括0,因此具有消除被零除的可能性等優點。 diff --git a/doc/zh_TW/API/types/classes/Ratio.md b/doc/zh_TW/API/types/classes/Ratio.md index 1e98ca7c..a3b9fb05 100644 --- a/doc/zh_TW/API/types/classes/Ratio.md +++ b/doc/zh_TW/API/types/classes/Ratio.md @@ -1,5 +1,7 @@ # Ratio +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Ratio.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Ratio.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 表示有理數的類型。 它主要用于當您要使用分數時。 實際上,Erg中的/運算符返回 Ratio。1/3等不被評估為 0.33333... 并且被處理為1/3。 此外,0.1 相當于 1/10。 所以`0.1 + 0.2 == 0.3`。 這聽起來很明顯,但在 Python中它是False。 但是,Ratio類型的效率往往比Float類型略低。 在執行速度很重要且不需要精確數值的地方應該使用浮點類型。 然而,正如Rob Pike所說,過早優化是萬惡之源。 在丟棄Ratio類型并使用Float類型之前,請進行真實的性能測試。 業余愛好者無條件偏愛較輕的模具。 diff --git a/doc/zh_TW/API/types/classes/Record.md b/doc/zh_TW/API/types/classes/Record.md index 1e9056a7..74bd0baf 100644 --- a/doc/zh_TW/API/types/classes/Record.md +++ b/doc/zh_TW/API/types/classes/Record.md @@ -1,5 +1,7 @@ # Record +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Record.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Record.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 記錄所屬的類。例如,`{i = 1}` 是`Structural {i = Int}` 類型的元素,并且是`{i = Int}` 類的實例 請注意,其他類的實例是記錄類型的元素,而不是記錄類的實例 diff --git a/doc/zh_TW/API/types/classes/Result.md b/doc/zh_TW/API/types/classes/Result.md index 43656839..0205b31f 100644 --- a/doc/zh_TW/API/types/classes/Result.md +++ b/doc/zh_TW/API/types/classes/Result.md @@ -1,5 +1,7 @@ # Result T, E +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Result.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Result.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ```python Result T, E <: Error = Either T, E ``` diff --git a/doc/zh_TW/API/types/classes/Str!.md b/doc/zh_TW/API/types/classes/Str!.md index 317d291d..62c50c4d 100644 --- a/doc/zh_TW/API/types/classes/Str!.md +++ b/doc/zh_TW/API/types/classes/Str!.md @@ -1,3 +1,5 @@ # StrWithLen! N: Nat! = Inherit StrWithLen N +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Str!.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Str!.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 表示可變長度字符串的類型 diff --git a/doc/zh_TW/API/types/classes/Str.md b/doc/zh_TW/API/types/classes/Str.md index b384d572..24c3cac3 100644 --- a/doc/zh_TW/API/types/classes/Str.md +++ b/doc/zh_TW/API/types/classes/Str.md @@ -1,5 +1,7 @@ # Str +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Str.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Str.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + (不變長度)表示字符串的類型。 簡單的 `Str` 類型是刪除了字符數的 `StrWithLen N` 類型(`Str = StrWithLen _`) ## 方法 diff --git a/doc/zh_TW/API/types/classes/StrWithLen.md b/doc/zh_TW/API/types/classes/StrWithLen.md index e69de29b..67caca65 100644 --- a/doc/zh_TW/API/types/classes/StrWithLen.md +++ b/doc/zh_TW/API/types/classes/StrWithLen.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/StrWithLen.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/StrWithLen.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/API/types/classes/Subroutine.md b/doc/zh_TW/API/types/classes/Subroutine.md index 60cbb806..5de32879 100644 --- a/doc/zh_TW/API/types/classes/Subroutine.md +++ b/doc/zh_TW/API/types/classes/Subroutine.md @@ -1,5 +1,7 @@ # Subroutine +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Subroutine.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Subroutine.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + Func和Proc的基本類型。 ## 方法 diff --git a/doc/zh_TW/API/types/classes/Tensor.md b/doc/zh_TW/API/types/classes/Tensor.md index b9cfd3f8..db3304b9 100644 --- a/doc/zh_TW/API/types/classes/Tensor.md +++ b/doc/zh_TW/API/types/classes/Tensor.md @@ -1,5 +1,7 @@ # Tensor Shape: [Nat; N] +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Tensor.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Tensor.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 用于有效操作多維數組的類。 它還定義了諸如多維數組上的乘法之類的操作 Matrix、Vector 等都繼承自該類型 diff --git a/doc/zh_TW/API/types/classes/TransCell(T).md b/doc/zh_TW/API/types/classes/TransCell(T).md index 38349392..cc95238c 100644 --- a/doc/zh_TW/API/types/classes/TransCell(T).md +++ b/doc/zh_TW/API/types/classes/TransCell(T).md @@ -1,5 +1,7 @@ # TransCell! T: Type! +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/TransCell(T).md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/TransCell(T).md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 它是一個單元格,其內容可以針對每個模具進行更改。 由于它是T類型的子類型,因此它也表現為T類型 當它在初始化時輸入T時很有用,并且在某個點之后總是輸入U diff --git a/doc/zh_TW/API/types/classes/Tuple.md b/doc/zh_TW/API/types/classes/Tuple.md index 9277cf54..fb0d5163 100644 --- a/doc/zh_TW/API/types/classes/Tuple.md +++ b/doc/zh_TW/API/types/classes/Tuple.md @@ -1,5 +1,7 @@ # Tuple T: ...Type +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Tuple.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Tuple.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 包含多種類型對象的集合 ## 方法 diff --git a/doc/zh_TW/API/types/classes/Type.md b/doc/zh_TW/API/types/classes/Type.md index e69de29b..dae4a5c2 100644 --- a/doc/zh_TW/API/types/classes/Type.md +++ b/doc/zh_TW/API/types/classes/Type.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Type.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Type.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/API/types/classes/Vector.md b/doc/zh_TW/API/types/classes/Vector.md index d5351a61..50e9b3d6 100644 --- a/doc/zh_TW/API/types/classes/Vector.md +++ b/doc/zh_TW/API/types/classes/Vector.md @@ -1,3 +1,5 @@ # Vector T: Num, N: Nat +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/classes/Vector.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/classes/Vector.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 表示向量的類型。與同名的Rust和C++類型不同,這種類型只處理數字。 \ No newline at end of file diff --git a/doc/zh_TW/API/types/patches/BinOp.md b/doc/zh_TW/API/types/patches/BinOp.md index 083de661..5fa493e7 100644 --- a/doc/zh_TW/API/types/patches/BinOp.md +++ b/doc/zh_TW/API/types/patches/BinOp.md @@ -1,5 +1,7 @@ # BinOp L, R, O +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/patches/BinOp.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/patches/BinOp.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 二元運算符的類型 ## 修補程序 diff --git a/doc/zh_TW/API/types/patches/UnaryOp.md b/doc/zh_TW/API/types/patches/UnaryOp.md index b4ec87f0..5ac2ae86 100644 --- a/doc/zh_TW/API/types/patches/UnaryOp.md +++ b/doc/zh_TW/API/types/patches/UnaryOp.md @@ -1,5 +1,7 @@ # UnaryOp T, O +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/patches/UnaryOp.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/patches/UnaryOp.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 一元運算符的類型 ## 定義 diff --git a/doc/zh_TW/API/types/traits/Add(R,O).md b/doc/zh_TW/API/types/traits/Add(R,O).md index 54182f26..726071f0 100644 --- a/doc/zh_TW/API/types/traits/Add(R,O).md +++ b/doc/zh_TW/API/types/traits/Add(R,O).md @@ -1,5 +1,7 @@ # Add R +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Add(R,O).md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Add(R,O).md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ```python Add R = Trait { .AddO = Type diff --git a/doc/zh_TW/API/types/traits/Div(R,O).md b/doc/zh_TW/API/types/traits/Div(R,O).md index 085960f6..664dc954 100644 --- a/doc/zh_TW/API/types/traits/Div(R,O).md +++ b/doc/zh_TW/API/types/traits/Div(R,O).md @@ -1,5 +1,7 @@ # Div R, O +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Div(R,O).md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Div(R,O).md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 如果除以零沒有錯誤,請使用“SafeDiv” ```python diff --git a/doc/zh_TW/API/types/traits/Eq.md b/doc/zh_TW/API/types/traits/Eq.md index e69de29b..6aed2ae0 100644 --- a/doc/zh_TW/API/types/traits/Eq.md +++ b/doc/zh_TW/API/types/traits/Eq.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Eq.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Eq.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/API/types/traits/Into.md b/doc/zh_TW/API/types/traits/Into.md index e9224512..83093df7 100644 --- a/doc/zh_TW/API/types/traits/Into.md +++ b/doc/zh_TW/API/types/traits/Into.md @@ -1,5 +1,7 @@ # Into T +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Into.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Into.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 一種類型,表明它可以被類型轉換為類型T。 即使Self和T之間沒有繼承關系,也是在關系可以相互轉換的時候定義的。 與繼承不同,沒有隱式轉換。您必須始終調用 `.into` 方法。 diff --git a/doc/zh_TW/API/types/traits/Iterable.md b/doc/zh_TW/API/types/traits/Iterable.md index e69de29b..ba458258 100644 --- a/doc/zh_TW/API/types/traits/Iterable.md +++ b/doc/zh_TW/API/types/traits/Iterable.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Iterable.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Iterable.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/API/types/traits/Num.md b/doc/zh_TW/API/types/traits/Num.md index 92315877..ca55178b 100644 --- a/doc/zh_TW/API/types/traits/Num.md +++ b/doc/zh_TW/API/types/traits/Num.md @@ -1,5 +1,7 @@ # Num +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Num.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Num.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ## 定義初始化 ```python diff --git a/doc/zh_TW/API/types/traits/Ord.md b/doc/zh_TW/API/types/traits/Ord.md index e69de29b..3ef5f04a 100644 --- a/doc/zh_TW/API/types/traits/Ord.md +++ b/doc/zh_TW/API/types/traits/Ord.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Ord.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Ord.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/API/types/traits/SafeDiv(R,O).md b/doc/zh_TW/API/types/traits/SafeDiv(R,O).md index 998faf89..03595643 100644 --- a/doc/zh_TW/API/types/traits/SafeDiv(R,O).md +++ b/doc/zh_TW/API/types/traits/SafeDiv(R,O).md @@ -1,5 +1,7 @@ # SafeDiv R, O +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/SafeDiv(R,O).md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/SafeDiv(R,O).md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ```python SafeDiv R, O = Subsume Div, { @Override diff --git a/doc/zh_TW/API/types/traits/Sample.md b/doc/zh_TW/API/types/traits/Sample.md index 7e57d1eb..5a601d84 100644 --- a/doc/zh_TW/API/types/traits/Sample.md +++ b/doc/zh_TW/API/types/traits/Sample.md @@ -1,5 +1,7 @@ # Sample +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Sample.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Sample.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 具有“隨機”選擇實例的`sample`和`sample!`方法的特征。`sample`方法總是返回相同的實例,而`sample!`方法返回一個隨機實例,該實例隨調用而變化 請注意,這是一個假設您想要一個適當的實例進行測試等的特征,并且它不一定是隨機的。 如果您想要隨機抽樣,請使用“隨機”模塊。 diff --git a/doc/zh_TW/API/types/traits/Seq.md b/doc/zh_TW/API/types/traits/Seq.md index e69de29b..007f7134 100644 --- a/doc/zh_TW/API/types/traits/Seq.md +++ b/doc/zh_TW/API/types/traits/Seq.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Seq.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Seq.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/API/types/traits/Show.md b/doc/zh_TW/API/types/traits/Show.md index e69de29b..30763e02 100644 --- a/doc/zh_TW/API/types/traits/Show.md +++ b/doc/zh_TW/API/types/traits/Show.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Show.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Show.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/API/types/traits/Unpack.md b/doc/zh_TW/API/types/traits/Unpack.md index e11011b1..37364850 100644 --- a/doc/zh_TW/API/types/traits/Unpack.md +++ b/doc/zh_TW/API/types/traits/Unpack.md @@ -1,5 +1,7 @@ # Unpack +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/API/types/traits/Unpack.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/API/types/traits/Unpack.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 標記性狀。實現時,元素可以像記錄一樣通過模式匹配來分解 ```python diff --git a/doc/zh_TW/compiler/TODO_hint.md b/doc/zh_TW/compiler/TODO_hint.md index 2cf268ad..69f19f36 100644 --- a/doc/zh_TW/compiler/TODO_hint.md +++ b/doc/zh_TW/compiler/TODO_hint.md @@ -1,4 +1,6 @@ # 提示(未實現) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/TODO_hint.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/TODO_hint.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + * `x 未定義`(x 已被`Del` 刪除)=> `提示:在第 X 行刪除` *補丁方法重復:“提示:指定補丁(如`T.foo(1)`)或使用`Del`刪除任何`.foo`” \ No newline at end of file diff --git a/doc/zh_TW/compiler/TODO_recov_suggest.md b/doc/zh_TW/compiler/TODO_recov_suggest.md index 07c6fc60..f21dd8bf 100644 --- a/doc/zh_TW/compiler/TODO_recov_suggest.md +++ b/doc/zh_TW/compiler/TODO_recov_suggest.md @@ -1,5 +1,7 @@ # 錯誤恢復建議(尚未實現) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/TODO_recov_suggest.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/TODO_recov_suggest.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + * `1 or 2`, `1 and 2` => `{1, 2}`? * `U = Inherit T` => 非類類型不能被繼承,或者`U = Class T`? * `Int and Str` => 不允許多重繼承,或者`Int or Str`? diff --git a/doc/zh_TW/compiler/TODO_warn.md b/doc/zh_TW/compiler/TODO_warn.md index a84e53c0..1fff72b1 100644 --- a/doc/zh_TW/compiler/TODO_warn.md +++ b/doc/zh_TW/compiler/TODO_warn.md @@ -1,5 +1,7 @@ # 警告(尚未實現) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/TODO_warn.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/TODO_warn.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + * `t = {(record type)}` => `T = {(record type)}`?(只有定義為常量的類型才能用于類型說明) * `{I: Int | ...}!` => `{I: Int! | ...}` * for/while 塊中的`return x`(`x != ()`) => `f::return`(外部塊)? \ No newline at end of file diff --git a/doc/zh_TW/compiler/abandoned.md b/doc/zh_TW/compiler/abandoned.md index d566fdf1..1ce62cce 100644 --- a/doc/zh_TW/compiler/abandoned.md +++ b/doc/zh_TW/compiler/abandoned.md @@ -1,5 +1,7 @@ # 廢棄/拒絕的語言規范 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/abandoned.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/abandoned.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + ## 重載(臨時多態性) 被放棄了,因為它可以用參數+子類型多態來代替,并且與Python的語義不兼容。 有關詳細信息,請參閱 [overload](../syntax/type/overloading.md) 文章。 diff --git a/doc/zh_TW/compiler/architecture.md b/doc/zh_TW/compiler/architecture.md index 9fddde10..30a908aa 100644 --- a/doc/zh_TW/compiler/architecture.md +++ b/doc/zh_TW/compiler/architecture.md @@ -1,5 +1,7 @@ # `ergc` 的架構 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/architecture.md%26commit_hash%3Da711efa99b325ba1012f6897e7b0e2bdb947d8a1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/architecture.md&commit_hash=a711efa99b325ba1012f6897e7b0e2bdb947d8a1) + ## 1. 掃描 Erg 腳本 (.er) 并生成 `TokenStream` (parser/lex.rs) * parser/lexer/Lexer 生成`TokenStream`(這是一個Token的迭代器,TokenStream可以通過lexer.collect()生成) diff --git a/doc/zh_TW/compiler/errors.md b/doc/zh_TW/compiler/errors.md index b0f043d9..1436942c 100644 --- a/doc/zh_TW/compiler/errors.md +++ b/doc/zh_TW/compiler/errors.md @@ -1,5 +1,7 @@ # Erg Compiler Errors +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/errors.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/errors.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## AssignError 嘗試重寫不可變變量時發生 diff --git a/doc/zh_TW/compiler/hir.md b/doc/zh_TW/compiler/hir.md index 48040873..addefb11 100644 --- a/doc/zh_TW/compiler/hir.md +++ b/doc/zh_TW/compiler/hir.md @@ -1,5 +1,7 @@ # 高級中間表示(HIR, High-level Intermediate Representation) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/hir.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/hir.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + HIR 是 Erg 編譯器從 AST 生成的結構 此結構包含源代碼中每個表達式的完整類型信息,并且在語法上已脫糖 AST與源代碼一一對應(純文本),但是HIR去掉了不必要的代碼信息,添加了省略的類型信息,所以HIR可以轉換為源代碼很難恢復 diff --git a/doc/zh_TW/compiler/index.md b/doc/zh_TW/compiler/index.md index e69de29b..33522b77 100644 --- a/doc/zh_TW/compiler/index.md +++ b/doc/zh_TW/compiler/index.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/index.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/index.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/compiler/inference.md b/doc/zh_TW/compiler/inference.md index 979baebf..719e1707 100644 --- a/doc/zh_TW/compiler/inference.md +++ b/doc/zh_TW/compiler/inference.md @@ -1,5 +1,7 @@ # 類型推斷算法 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/inference.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/inference.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + > __Warning__:此部分正在編輯中,可能包含一些錯誤 顯示了下面使用的符號 diff --git a/doc/zh_TW/compiler/overview.md b/doc/zh_TW/compiler/overview.md index 8d7d86c8..73061113 100644 --- a/doc/zh_TW/compiler/overview.md +++ b/doc/zh_TW/compiler/overview.md @@ -1,5 +1,7 @@ # `erg` 概覽 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/overview.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/overview.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 我們將介紹每一層的功能以及特別重要的功能和方法。 ## 1. 詞法分析 diff --git a/doc/zh_TW/compiler/parsing.md b/doc/zh_TW/compiler/parsing.md index 501e2bf8..3d6d4600 100644 --- a/doc/zh_TW/compiler/parsing.md +++ b/doc/zh_TW/compiler/parsing.md @@ -1,5 +1,7 @@ # 解析 Erg 語言 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/parsing.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/parsing.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## 空格的處理 Erg語法的一個特點是它對空間敏感。 diff --git a/doc/zh_TW/compiler/refinement_subtyping.md b/doc/zh_TW/compiler/refinement_subtyping.md index aa0cf9ba..5fb30dae 100644 --- a/doc/zh_TW/compiler/refinement_subtyping.md +++ b/doc/zh_TW/compiler/refinement_subtyping.md @@ -1,5 +1,7 @@ # 篩子類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/refinement_subtyping.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/refinement_subtyping.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ```python {I: Int | I >= 0} {S: StrWithLen N | N >= 1} diff --git a/doc/zh_TW/compiler/trait_method_resolving.md b/doc/zh_TW/compiler/trait_method_resolving.md index 1f3a6f88..68fa15ec 100644 --- a/doc/zh_TW/compiler/trait_method_resolving.md +++ b/doc/zh_TW/compiler/trait_method_resolving.md @@ -1,5 +1,7 @@ # 解決補丁方法 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/trait_method_resolving.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/trait_method_resolving.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + `Nat` 是零個或多個`Int`,`Int` 的子類型。 `Nat` 在 Python 類層次結構中不存在。 我想知道 Erg 是如何解決這個補丁方法的? diff --git a/doc/zh_TW/compiler/transpile.md b/doc/zh_TW/compiler/transpile.md index fa0afc6b..5cffba68 100644 --- a/doc/zh_TW/compiler/transpile.md +++ b/doc/zh_TW/compiler/transpile.md @@ -1,5 +1,7 @@ # Erg 代碼如何轉譯成 Python 代碼? +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/transpile.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/transpile.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 準確地說,Erg 代碼被轉譯為 Python 字節碼。 但是,由于 Python 字節碼幾乎可以重構為 Python 代碼,因此這里以等效的 Python 代碼為例。 順便說一句,這里展示的示例是低優化級別。 diff --git a/doc/zh_TW/compiler/type_var_normalization.md b/doc/zh_TW/compiler/type_var_normalization.md index cbf621e6..fa6e704e 100644 --- a/doc/zh_TW/compiler/type_var_normalization.md +++ b/doc/zh_TW/compiler/type_var_normalization.md @@ -1,5 +1,7 @@ # 歸一化 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/compiler/type_var_normalization.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/compiler/type_var_normalization.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + * Erg 的類型參數規范化基于 SymPy 的簡化函數。 例如,當您定義 `concat: |T, M, N|([T; M], [T; N] -> [T; M+N])` 時,您可以匹配類型變量和參數而無需實例化它們.必須作出判斷。 diff --git a/doc/zh_TW/dev_guide/branches.md b/doc/zh_TW/dev_guide/branches.md index 599d39a7..0d39107e 100644 --- a/doc/zh_TW/dev_guide/branches.md +++ b/doc/zh_TW/dev_guide/branches.md @@ -1,5 +1,7 @@ # 分支機構命名和運營策略 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/branches.md%26commit_hash%3Da711efa99b325ba1012f6897e7b0e2bdb947d8a1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/branches.md&commit_hash=a711efa99b325ba1012f6897e7b0e2bdb947d8a1) + ## main * 主要開發分支 diff --git a/doc/zh_TW/dev_guide/build_features.md b/doc/zh_TW/dev_guide/build_features.md index 1aea65b9..49731e40 100644 --- a/doc/zh_TW/dev_guide/build_features.md +++ b/doc/zh_TW/dev_guide/build_features.md @@ -1,5 +1,7 @@ # `erg` 構建功能 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/build_features.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/build_features.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ## 調試 進入調試模式。結果,Erg 內部的行為順序顯示在日志中。 diff --git a/doc/zh_TW/dev_guide/directories.md b/doc/zh_TW/dev_guide/directories.md index 542ae411..fa2cd397 100644 --- a/doc/zh_TW/dev_guide/directories.md +++ b/doc/zh_TW/dev_guide/directories.md @@ -1,5 +1,7 @@ # Erg存儲表結構 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/directories.md%26commit_hash%3Da711efa99b325ba1012f6897e7b0e2bdb947d8a1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/directories.md&commit_hash=a711efa99b325ba1012f6897e7b0e2bdb947d8a1) + ```console └─┬ assets:圖片等 ├─ CODE_OF_CONDUCT:行為準則 diff --git a/doc/zh_TW/dev_guide/doc_guideline.md b/doc/zh_TW/dev_guide/doc_guideline.md index 9c2e5241..30f29259 100644 --- a/doc/zh_TW/dev_guide/doc_guideline.md +++ b/doc/zh_TW/dev_guide/doc_guideline.md @@ -1,5 +1,7 @@ # 格式 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/doc_guideline.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/doc_guideline.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 任何不符合以下規則的文件都將得到更正。 * 以某種語氣寫代碼注釋或內部文檔。 diff --git a/doc/zh_TW/dev_guide/env.md b/doc/zh_TW/dev_guide/env.md index 99679c35..43511997 100644 --- a/doc/zh_TW/dev_guide/env.md +++ b/doc/zh_TW/dev_guide/env.md @@ -1,5 +1,7 @@ # 開發環境 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/env.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/env.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + ## 你需要安裝什么 * Rust(與 rustup 一起安裝) diff --git a/doc/zh_TW/dev_guide/faq_syntax.md b/doc/zh_TW/dev_guide/faq_syntax.md index af1cb5f9..68d760b8 100644 --- a/doc/zh_TW/dev_guide/faq_syntax.md +++ b/doc/zh_TW/dev_guide/faq_syntax.md @@ -1,5 +1,7 @@ # Erg design's "Why" and Answers +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/faq_syntax.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/faq_syntax.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ## 當我們有所有權系統時,為什么要與 GC 共存? 因為 Erg 推出所有權系統的動機并不是為了 Rust 那樣的“不依賴 GC 的內存管理”。最初,由于 Erg 是一種語言,目前使用 Python VM,因此最終仍使用 GC。Erg 引入產權系統的目標是“可變狀態的局部化”。在 Erg 中,可變對象具有所有權概念。這是根據共享可變狀態容易成為 bug 的溫床,甚至是類型安全性的侵犯(詳見)來判斷的。 @@ -48,7 +50,6 @@ assert S.i == Int 在 Erg 中,運算符使你可以在不太注意錯誤的情況下編寫。 - ```python read_file!() = f = open!("foo.txt")? # 如果失敗則立即返回錯誤,所以 f 是文件類型 @@ -77,7 +78,6 @@ Python 的庫中有一些類設計為繼承,如果完全取消繼承,這些 默認情況下,指向結構托盤會使類型指定變得復雜,并且可能會混合程序員的非預期行為。 - ```python # 如果 T 是結構特征的子類型... # f: |T <: Structural Trait {.`_+_` = Self.(Self) -> Self; .`_-_` = Self.(Self) -> Self}| (T, T) -> T diff --git a/doc/zh_TW/dev_guide/i18n_messages.md b/doc/zh_TW/dev_guide/i18n_messages.md index e663e5bd..f02827b9 100644 --- a/doc/zh_TW/dev_guide/i18n_messages.md +++ b/doc/zh_TW/dev_guide/i18n_messages.md @@ -1,5 +1,7 @@ # 多語言錯誤信息 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/i18n_messages.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/i18n_messages.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + Erg 正在推動消息(開始、選項、文檔、提示、警告、錯誤消息等)的多語言化。如果你不熟悉 Rust 或 Erg,也可以參與此項目。請務必配合。 以下是多語種方法的說明。 diff --git a/doc/zh_TW/dev_guide/index.md b/doc/zh_TW/dev_guide/index.md index e69de29b..0e41be9e 100644 --- a/doc/zh_TW/dev_guide/index.md +++ b/doc/zh_TW/dev_guide/index.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/index.md%26commit_hash%3D7d43acdf0e2b71528b038b9a8e70be6c93831f96)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/index.md&commit_hash=7d43acdf0e2b71528b038b9a8e70be6c93831f96) + diff --git a/doc/zh_TW/dev_guide/rust_code_guideline.md b/doc/zh_TW/dev_guide/rust_code_guideline.md index d76615d9..93811890 100644 --- a/doc/zh_TW/dev_guide/rust_code_guideline.md +++ b/doc/zh_TW/dev_guide/rust_code_guideline.md @@ -1,5 +1,7 @@ # Rust 代碼指南 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/rust_code_guideline.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/rust_code_guideline.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + ## 本地規則 * 使用 `log!` 進行調試輸出(使用 `println!` 等進行輸出處理,這也是發布所必需的)。 diff --git a/doc/zh_TW/dev_guide/terms.md b/doc/zh_TW/dev_guide/terms.md index 4d970d66..e9a57f8e 100644 --- a/doc/zh_TW/dev_guide/terms.md +++ b/doc/zh_TW/dev_guide/terms.md @@ -1,5 +1,7 @@ # 詞匯表 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/terms.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/terms.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ## 象征 ### ! diff --git a/doc/zh_TW/dev_guide/unify_terms.md b/doc/zh_TW/dev_guide/unify_terms.md index 49a40529..d1d804dc 100644 --- a/doc/zh_TW/dev_guide/unify_terms.md +++ b/doc/zh_TW/dev_guide/unify_terms.md @@ -1,5 +1,7 @@ # 術語統一 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/dev_guide/unify_terms.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/dev_guide/unify_terms.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ## 可訪問性,可見性 使用可見性。 diff --git a/doc/zh_TW/faq_general.md b/doc/zh_TW/faq_general.md index 9c8181f1..b687922b 100644 --- a/doc/zh_TW/faq_general.md +++ b/doc/zh_TW/faq_general.md @@ -1,8 +1,10 @@ # Erg常見問題 -此常見問題解答適用于一般 Erg 初學者。 -對于個別(常見)技術問題,請參閱 [此處](./faq_technical.md) 了解個別(常見)技術問題,以及 -[這里](./dev_guide/faq_syntax.md) 了解更多信息。 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/faq_general.md%26commit_hash%3Deccd113c1512076c367fb87ea73406f91ff83ba7)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/faq_general.md&commit_hash=eccd113c1512076c367fb87ea73406f91ff83ba7) + +This FAQ is intended for the general Erg beginner. +For individual (common) technical issues, please refer to [here](./faq_technical.md) for individual (common) technical issues, and +[Here](./dev_guide/faq_syntax.md) for more information. ## Erg 是 Python 兼容語言是什么意思? diff --git a/doc/zh_TW/faq_technical.md b/doc/zh_TW/faq_technical.md index 8fcf254d..61fcc532 100644 --- a/doc/zh_TW/faq_technical.md +++ b/doc/zh_TW/faq_technical.md @@ -1,5 +1,6 @@ # 技術常見問題 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/faq_technical.md%26commit_hash%3Dc120700585fdb1d655255c8e2817bb13cc8d369e)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/faq_technical.md&commit_hash=c120700585fdb1d655255c8e2817bb13cc8d369e) 本節回答有關使用 Erg 語言的技術問題。換句話說,它包含以 What 或 Which 開頭的問題,以及可以用 Yes/No 回答的問題。 diff --git a/doc/zh_TW/improved_points.md b/doc/zh_TW/improved_points.md index 8d99907b..3c8383d5 100644 --- a/doc/zh_TW/improved_points.md +++ b/doc/zh_TW/improved_points.md @@ -1,5 +1,7 @@ # Python 的改進 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/improved_points.md%26commit_hash%3Deccd113c1512076c367fb87ea73406f91ff83ba7)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/improved_points.md&commit_hash=eccd113c1512076c367fb87ea73406f91ff83ba7) + ## 執行靜態分析(靜態類型檢查、變量和屬性檢查) 靜態類型檢查的好處現在怎么強調都不為過,但是檢查變量和屬性的存在也是相當重要的一部分。 diff --git a/doc/zh_TW/index.md b/doc/zh_TW/index.md index 821be649..f97500ce 100644 --- a/doc/zh_TW/index.md +++ b/doc/zh_TW/index.md @@ -1,5 +1,7 @@ # 索引 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/index.md%26commit_hash%3Deccd113c1512076c367fb87ea73406f91ff83ba7)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/index.md&commit_hash=eccd113c1512076c367fb87ea73406f91ff83ba7) + ## [API/](./API/index.md) 本節介紹 Erg 的內置或標準庫提供的子程序、類型、常量等的規范。 diff --git a/doc/zh_TW/migration_from_py.md b/doc/zh_TW/migration_from_py.md index 80a5c66b..74abaa03 100644 --- a/doc/zh_TW/migration_from_py.md +++ b/doc/zh_TW/migration_from_py.md @@ -1,5 +1,7 @@ # 從 Python 遷移到 Erg 的提示 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/migration_from_py.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/migration_from_py.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ## 我想將字符串轉換為 int 等。 使用 `Str` 類的 `parse` 方法。 它返回一個 `Result` 類型。 diff --git a/doc/zh_TW/python/bytecode_instructions.md b/doc/zh_TW/python/bytecode_instructions.md index 47e3ae8f..35715f37 100644 --- a/doc/zh_TW/python/bytecode_instructions.md +++ b/doc/zh_TW/python/bytecode_instructions.md @@ -1,5 +1,7 @@ # Python 字節碼指令 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/python/bytecode_instructions.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/python/bytecode_instructions.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + Python 字節碼變量操作命令通過 名稱索引(名稱索引)訪問。 這是為了在 Python 中實現動態變量訪問(可以使用 eval 等作為字符串訪問)。 一條指令為 2 個字節,指令和參數以 little endian 形式存儲。 不帶參數的指令也使用 2 個字節(參數部分為 0)。 diff --git a/doc/zh_TW/python/bytecode_specification.md b/doc/zh_TW/python/bytecode_specification.md index d0a56f9c..8606d9c6 100644 --- a/doc/zh_TW/python/bytecode_specification.md +++ b/doc/zh_TW/python/bytecode_specification.md @@ -1,5 +1,7 @@ # Python bytecode specification +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/python/bytecode_specification.md%26commit_hash%3D9f6a4a43fcf7e4f58cabe6e5a7546820fd9f5ff4)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/python/bytecode_specification.md&commit_hash=9f6a4a43fcf7e4f58cabe6e5a7546820fd9f5ff4) + ## Format * 0~3 byte(u32): magic number (see common/bytecode.rs for details) @@ -70,7 +72,6 @@ * 1~4 byte: length of string * 5~ byte: payload - # Python 字節碼規范 ## 格式 diff --git a/doc/zh_TW/python/class_system.md b/doc/zh_TW/python/class_system.md index 8453038a..63606bbd 100644 --- a/doc/zh_TW/python/class_system.md +++ b/doc/zh_TW/python/class_system.md @@ -1,5 +1,7 @@ # Python 類系統(與 Erg 比較) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/python/class_system.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/python/class_system.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## 方法 方法可以被前向引用,但這不是一種特殊的技術。 diff --git a/doc/zh_TW/python/index.md b/doc/zh_TW/python/index.md index e69de29b..2168ad9d 100644 --- a/doc/zh_TW/python/index.md +++ b/doc/zh_TW/python/index.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/python/index.md%26commit_hash%3D9f6a4a43fcf7e4f58cabe6e5a7546820fd9f5ff4)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/python/index.md&commit_hash=9f6a4a43fcf7e4f58cabe6e5a7546820fd9f5ff4) + diff --git a/doc/zh_TW/syntax/00_basic.md b/doc/zh_TW/syntax/00_basic.md index 21a26fd2..03aa32e7 100644 --- a/doc/zh_TW/syntax/00_basic.md +++ b/doc/zh_TW/syntax/00_basic.md @@ -1,5 +1,7 @@ # 基本 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/00_basic.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/00_basic.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + > __Warning__:本文檔不完整。 它未經校對(樣式、正確鏈接、誤譯等)。 此外,Erg 的語法可能在版本 0.* 期間發生破壞性更改,并且文檔可能沒有相應更新。 請事先了解這一點。 > 如果您在本文檔中發現任何錯誤,請報告至 [此處的表單](https://forms.gle/HtLYRfYzWCAaeTGb6) 或 [GitHub repo](https://github.com/mtshiba/TheErgBook/issues/new )。 我們將不勝感激您的建議。 diff --git a/doc/zh_TW/syntax/01_literal.md b/doc/zh_TW/syntax/01_literal.md index 44b9610e..25bc6f1b 100644 --- a/doc/zh_TW/syntax/01_literal.md +++ b/doc/zh_TW/syntax/01_literal.md @@ -1,5 +1,7 @@ # 字面量 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/01_literal.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/01_literal.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## 基本字面量 ### 整數字面量 @@ -135,7 +137,6 @@ assert 0.0f32 == 0.0f64 一個“復雜”對象只是一個虛數單位對象`im`的算術組合 - ## *-less 乘法 在 Erg 中,您可以省略 `*` 來表示乘法,只要解釋上沒有混淆即可。 但是,運算符的組合強度設置為強于 `*`。 diff --git a/doc/zh_TW/syntax/02_name.md b/doc/zh_TW/syntax/02_name.md index 336458f2..5feed6d3 100644 --- a/doc/zh_TW/syntax/02_name.md +++ b/doc/zh_TW/syntax/02_name.md @@ -1,5 +1,7 @@ # 多變的 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/02_name.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/02_name.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 變量是一種代數; Erg 中的代數 - 如果沒有混淆,有時簡稱為變量 - 指的是命名對象并使它們可從代碼的其他地方引用的功能。 變量定義如下。 diff --git a/doc/zh_TW/syntax/03_declaration.md b/doc/zh_TW/syntax/03_declaration.md index 7de06ec0..b984c65a 100644 --- a/doc/zh_TW/syntax/03_declaration.md +++ b/doc/zh_TW/syntax/03_declaration.md @@ -1,5 +1,7 @@ # 宣言(Declaration) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/03_declaration.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/03_declaration.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 聲明是用于指定要使用的變量類型的語法。 可以在代碼中的任何地方進行聲明,但單獨的聲明并不引用變量。 它們必須被初始化。 分配后,可以檢查聲明以確保類型與分配它的對象兼容。 diff --git a/doc/zh_TW/syntax/04_function.md b/doc/zh_TW/syntax/04_function.md index 02e4706e..25389c36 100644 --- a/doc/zh_TW/syntax/04_function.md +++ b/doc/zh_TW/syntax/04_function.md @@ -1,5 +1,7 @@ # 功能 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/04_function.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/04_function.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 函數是一個塊,它接受一個“參數”,對其進行處理,并將其作為“返回值”返回。 定義如下。 ```python diff --git a/doc/zh_TW/syntax/05_builtin_funcs.md b/doc/zh_TW/syntax/05_builtin_funcs.md index 294ab71e..db2204b0 100644 --- a/doc/zh_TW/syntax/05_builtin_funcs.md +++ b/doc/zh_TW/syntax/05_builtin_funcs.md @@ -1,5 +1,7 @@ # 內置函數 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/05_builtin_funcs.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/05_builtin_funcs.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## 如果 `if` 是一個根據條件改變處理的函數。 diff --git a/doc/zh_TW/syntax/06_operator.md b/doc/zh_TW/syntax/06_operator.md index ee6f32cf..84e7d71f 100644 --- a/doc/zh_TW/syntax/06_operator.md +++ b/doc/zh_TW/syntax/06_operator.md @@ -1,5 +1,7 @@ # 運算符 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/06_operator.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/06_operator.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 運算符是表示操作的符號。 操作數是運算符(左)右側的東西。 運算符是一種函數,因此它們本身就是可以綁定到變量的一流對象。 綁定時,需要用```括起來。 diff --git a/doc/zh_TW/syntax/07_side_effect.md b/doc/zh_TW/syntax/07_side_effect.md index d1dada58..35722f81 100644 --- a/doc/zh_TW/syntax/07_side_effect.md +++ b/doc/zh_TW/syntax/07_side_effect.md @@ -1,5 +1,7 @@ # 副作用和程序 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/07_side_effect.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/07_side_effect.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 我們一直忽略了解釋“!”的含義,但現在它的含義終于要揭曉了。 這個 `!` 表示這個對象是一個帶有“副作用”的“過程”。 過程是具有副作用的函數。 ```python diff --git a/doc/zh_TW/syntax/08_procedure.md b/doc/zh_TW/syntax/08_procedure.md index a381e88f..d0f5408b 100644 --- a/doc/zh_TW/syntax/08_procedure.md +++ b/doc/zh_TW/syntax/08_procedure.md @@ -1,5 +1,7 @@ # 程序 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/08_procedure.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/08_procedure.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 處理可變對象時需要過程,但將可變對象作為參數并不一定使其成為過程。 這是一個函數接受一個可變對象(不是過程)。 diff --git a/doc/zh_TW/syntax/09_builtin_procs.md b/doc/zh_TW/syntax/09_builtin_procs.md index 25559d98..67130a36 100644 --- a/doc/zh_TW/syntax/09_builtin_procs.md +++ b/doc/zh_TW/syntax/09_builtin_procs.md @@ -1,5 +1,7 @@ # 內置程序 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/09_builtin_procs.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/09_builtin_procs.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## id! 返回對象的唯一標識號。 diff --git a/doc/zh_TW/syntax/10_array.md b/doc/zh_TW/syntax/10_array.md index 892ad80a..cad38bb1 100644 --- a/doc/zh_TW/syntax/10_array.md +++ b/doc/zh_TW/syntax/10_array.md @@ -1,5 +1,7 @@ # Array +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/10_array.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/10_array.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 數組是最基本的__collection(聚合)__。 集合是一個可以在其中包含多個對象的對象。 diff --git a/doc/zh_TW/syntax/11_tuple.md b/doc/zh_TW/syntax/11_tuple.md index 7c62c2f4..0b35dc97 100644 --- a/doc/zh_TW/syntax/11_tuple.md +++ b/doc/zh_TW/syntax/11_tuple.md @@ -1,5 +1,7 @@ # 元組 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/11_tuple.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/11_tuple.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 元組類似于數組,但可以保存不同類型的對象。 這樣的集合稱為不等集合。 相比之下,同構集合包括數組、集合等。 diff --git a/doc/zh_TW/syntax/12_dict.md b/doc/zh_TW/syntax/12_dict.md index 235071d9..a8ff4003 100644 --- a/doc/zh_TW/syntax/12_dict.md +++ b/doc/zh_TW/syntax/12_dict.md @@ -1,5 +1,7 @@ # 字典 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/12_dict.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/12_dict.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + Dict 是鍵/值對的集合。 ```python diff --git a/doc/zh_TW/syntax/13_record.md b/doc/zh_TW/syntax/13_record.md index 19e4252d..0c713680 100644 --- a/doc/zh_TW/syntax/13_record.md +++ b/doc/zh_TW/syntax/13_record.md @@ -1,5 +1,7 @@ # 記錄(Record) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/13_record.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/13_record.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 記錄是一個集合,它結合了通過鍵訪問的 Dict 和在編譯時檢查其訪問的元組的屬性。 如果您了解 JavaScript,請將其視為一種(更增強的)對象字面量表示法。 diff --git a/doc/zh_TW/syntax/14_set.md b/doc/zh_TW/syntax/14_set.md index 304b5cc0..0591a777 100644 --- a/doc/zh_TW/syntax/14_set.md +++ b/doc/zh_TW/syntax/14_set.md @@ -1,5 +1,7 @@ # Set +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/14_set.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/14_set.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 一個Set代表一個集合,它在結構上是一個重復的無序數組。 ```python diff --git a/doc/zh_TW/syntax/15_type.md b/doc/zh_TW/syntax/15_type.md index 9d39a89d..c547d3bd 100644 --- a/doc/zh_TW/syntax/15_type.md +++ b/doc/zh_TW/syntax/15_type.md @@ -1,5 +1,7 @@ # 類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/15_type.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/15_type.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 類型是 Erg 中一個非常重要的特性,所以我們有一個 [dedicated section](./type/01_type_system.md)。 請看那里。

diff --git a/doc/zh_TW/syntax/16_iterator.md b/doc/zh_TW/syntax/16_iterator.md index be023422..bbd0a511 100644 --- a/doc/zh_TW/syntax/16_iterator.md +++ b/doc/zh_TW/syntax/16_iterator.md @@ -1,5 +1,7 @@ # 迭代器 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/16_iterator.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/16_iterator.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 迭代器是用于檢索容器元素的對象。 ```python diff --git a/doc/zh_TW/syntax/17_mutability.md b/doc/zh_TW/syntax/17_mutability.md index 41988a44..339cb1cf 100644 --- a/doc/zh_TW/syntax/17_mutability.md +++ b/doc/zh_TW/syntax/17_mutability.md @@ -1,5 +1,7 @@ # 可變性 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/17_mutability.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/17_mutability.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 正如我們已經看到的,所有 Erg 變量都是不可變的。 但是,Erg 對象具有可變性的概念。 以下面的代碼為例。 diff --git a/doc/zh_TW/syntax/18_ownership.md b/doc/zh_TW/syntax/18_ownership.md index 8bbdf86a..39656902 100644 --- a/doc/zh_TW/syntax/18_ownership.md +++ b/doc/zh_TW/syntax/18_ownership.md @@ -1,5 +1,7 @@ #所有權制度 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/18_ownership.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/18_ownership.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 由于 Erg 是一種使用 Python 作為宿主語言的語言,因此內存管理的方法取決于 Python 的實現。 但語義上 Erg 的內存管理與 Python 的不同。 一個顯著的區別在于所有權制度和禁止循環引用。 diff --git a/doc/zh_TW/syntax/19_visibility.md b/doc/zh_TW/syntax/19_visibility.md index 2bec3898..e6d5090b 100644 --- a/doc/zh_TW/syntax/19_visibility.md +++ b/doc/zh_TW/syntax/19_visibility.md @@ -1,5 +1,7 @@ # 可見性 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/19_visibility.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/19_visibility.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + Erg 變量具有 __visibility__ 的概念。 到目前為止,我們看到的所有變量都稱為 __private variables__。 這是一個外部不可見的變量。 例如,`foo` 模塊中定義的私有變量不能被另一個模塊引用。 diff --git a/doc/zh_TW/syntax/20_naming_rule.md b/doc/zh_TW/syntax/20_naming_rule.md index 7c946340..640c1262 100644 --- a/doc/zh_TW/syntax/20_naming_rule.md +++ b/doc/zh_TW/syntax/20_naming_rule.md @@ -1,5 +1,7 @@ # 命名約定 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/20_naming_rule.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/20_naming_rule.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 如果要將變量用作常量表達式,請確保它以大寫字母開頭。 兩個或多個字母可能是小寫的。 ```python diff --git a/doc/zh_TW/syntax/21_lambda.md b/doc/zh_TW/syntax/21_lambda.md index bb8e00dc..6b240482 100644 --- a/doc/zh_TW/syntax/21_lambda.md +++ b/doc/zh_TW/syntax/21_lambda.md @@ -1,5 +1,7 @@ # 匿名函數 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/21_lambda.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/21_lambda.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 匿名函數是一種無需命名即可動態創建函數對象的語法。 ```python @@ -59,7 +61,6 @@ now = if! True: 您還可以鍵入和模式匹配。 正因為如此,`match` 函數大多是借助匿名函數的力量來實現的。 作為 `match` 函數的參數給出的匿名函數從頂部開始按順序嘗試。 因此,您應該在頂部描述特殊情況,在底部描述更一般的情況。 如果你弄錯了順序,編譯器會發出警告(如果可能的話) - ```python n = (Complex or Ratio or Int).sample!() i = matchn: diff --git a/doc/zh_TW/syntax/22_subroutine.md b/doc/zh_TW/syntax/22_subroutine.md index da449e98..29f7b790 100644 --- a/doc/zh_TW/syntax/22_subroutine.md +++ b/doc/zh_TW/syntax/22_subroutine.md @@ -1,5 +1,7 @@ # 子程序簽名 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/22_subroutine.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/22_subroutine.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## 函數 ```python diff --git a/doc/zh_TW/syntax/23_closure.md b/doc/zh_TW/syntax/23_closure.md index 67e9b0c1..f8586ffa 100644 --- a/doc/zh_TW/syntax/23_closure.md +++ b/doc/zh_TW/syntax/23_closure.md @@ -1,5 +1,7 @@ # 關閉 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/23_closure.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/23_closure.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + Erg 子例程有一個稱為“閉包”的功能,可以捕獲外部變量。 ```python diff --git a/doc/zh_TW/syntax/24_module.md b/doc/zh_TW/syntax/24_module.md index eff76cdd..8d18f7bc 100644 --- a/doc/zh_TW/syntax/24_module.md +++ b/doc/zh_TW/syntax/24_module.md @@ -1,5 +1,7 @@ # module +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/24_module.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/24_module.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + Erg allows you to think of the file itself as a single record. This is called a module. ```python: foo.er diff --git a/doc/zh_TW/syntax/25_object_system.md b/doc/zh_TW/syntax/25_object_system.md index ce089cc3..317f702b 100644 --- a/doc/zh_TW/syntax/25_object_system.md +++ b/doc/zh_TW/syntax/25_object_system.md @@ -1,5 +1,7 @@ # 目的 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/25_object_system.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/25_object_system.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 可以分配給變量的所有數據。 `Object` 類的屬性如下。 * `.__repr__`:返回對象的(非豐富)字符串表示 diff --git a/doc/zh_TW/syntax/26_pattern_matching.md b/doc/zh_TW/syntax/26_pattern_matching.md index 9c4cdbd5..411650fd 100644 --- a/doc/zh_TW/syntax/26_pattern_matching.md +++ b/doc/zh_TW/syntax/26_pattern_matching.md @@ -1,5 +1,7 @@ # 模式匹配,可反駁 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/26_pattern_matching.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/26_pattern_matching.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ## Erg 中可用的模式 ### 變量模式 diff --git a/doc/zh_TW/syntax/27_comprehension.md b/doc/zh_TW/syntax/27_comprehension.md index 1aae05b8..9ba5b6fc 100644 --- a/doc/zh_TW/syntax/27_comprehension.md +++ b/doc/zh_TW/syntax/27_comprehension.md @@ -1,5 +1,7 @@ # Comprehension +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/27_comprehension.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/27_comprehension.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + Array 和 `[expr | (name <- iterable)+ (predicate)*]`, set 和 `{expr | (name <- iterable)+ (predicate)*}`, 你可以創建一個字典 `{key: value | (name <- iterable)+ (predicate)*}`. diff --git a/doc/zh_TW/syntax/28_spread_syntax.md b/doc/zh_TW/syntax/28_spread_syntax.md index ab3c96fd..60630b96 100644 --- a/doc/zh_TW/syntax/28_spread_syntax.md +++ b/doc/zh_TW/syntax/28_spread_syntax.md @@ -1,5 +1,7 @@ # 傳播賦值 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/28_spread_syntax.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/28_spread_syntax.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 在分解賦值中,將 `...` 放在變量前面會將所有剩余元素展開到該變量中。 這稱為擴展賦值。 ```python diff --git a/doc/zh_TW/syntax/29_decorator.md b/doc/zh_TW/syntax/29_decorator.md index c419cd4a..1b19af3a 100644 --- a/doc/zh_TW/syntax/29_decorator.md +++ b/doc/zh_TW/syntax/29_decorator.md @@ -1,5 +1,7 @@ # 裝飾器(修飾符) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/29_decorator.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/29_decorator.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 裝飾器用于向類型或函數添加或演示特定狀態或行為。 裝飾器的語法如下。 diff --git a/doc/zh_TW/syntax/30_error_handling.md b/doc/zh_TW/syntax/30_error_handling.md index 3c549435..c58e6dd7 100644 --- a/doc/zh_TW/syntax/30_error_handling.md +++ b/doc/zh_TW/syntax/30_error_handling.md @@ -1,5 +1,7 @@ # 錯誤處理系統 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/30_error_handling.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/30_error_handling.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 主要使用Result類型。 在 Erg 中,如果您丟棄 Error 類型的對象(頂層不支持),則會發生錯誤。 diff --git a/doc/zh_TW/syntax/31_pipeline.md b/doc/zh_TW/syntax/31_pipeline.md index b8de0cf1..4d1f736e 100644 --- a/doc/zh_TW/syntax/31_pipeline.md +++ b/doc/zh_TW/syntax/31_pipeline.md @@ -1,5 +1,7 @@ # 管道運算符 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/31_pipeline.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/31_pipeline.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 管道運算符的使用方式如下: ```python diff --git a/doc/zh_TW/syntax/32_integration_with_Python.md b/doc/zh_TW/syntax/32_integration_with_Python.md index 6f2c4d56..3649c674 100644 --- a/doc/zh_TW/syntax/32_integration_with_Python.md +++ b/doc/zh_TW/syntax/32_integration_with_Python.md @@ -1,5 +1,7 @@ # 與 Python 集成 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/32_integration_with_Python.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/32_integration_with_Python.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## 導出到 Python 編譯 Erg 腳本時,會生成一個 .pyc 文件,可以簡單地將其作為 Python 模塊導入。 @@ -65,7 +67,6 @@ assert foo.bar(1) in Int 這通過在運行時執行類型檢查來確保類型安全。 ``declare`` 函數大致如下工作 - ```python declare|S: Subroutine| sub!: S, T = # 實際上,=> 可以強制轉換為沒有塊副作用的函數 diff --git a/doc/zh_TW/syntax/33_package_system.md b/doc/zh_TW/syntax/33_package_system.md index db6a9367..7946a2c8 100644 --- a/doc/zh_TW/syntax/33_package_system.md +++ b/doc/zh_TW/syntax/33_package_system.md @@ -1,5 +1,7 @@ # 打包系統 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/33_package_system.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/33_package_system.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + Erg包大致可以分為app包,即應用程序,以及lib包,即庫。 應用包的入口點是`src/app.er`。 `app.er` 中定義的`main` 函數被執行。 lib 包的入口點是`src/lib.er`。導入包相當于導入 `lib.er`。 diff --git a/doc/zh_TW/syntax/34_generator.md b/doc/zh_TW/syntax/34_generator.md index 34c3fceb..e6c55854 100644 --- a/doc/zh_TW/syntax/34_generator.md +++ b/doc/zh_TW/syntax/34_generator.md @@ -1,5 +1,7 @@ # 生成器 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/34_generator.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/34_generator.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 生成器是在塊中使用 `yield!` 過程的特殊過程。 ```python diff --git a/doc/zh_TW/syntax/SUMMARY.md b/doc/zh_TW/syntax/SUMMARY.md index 55ad61ad..1fa1e2c4 100644 --- a/doc/zh_TW/syntax/SUMMARY.md +++ b/doc/zh_TW/syntax/SUMMARY.md @@ -1,5 +1,7 @@ # 概括 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/SUMMARY.md%26commit_hash%3D2ce482b1c8407332b3b74f4c3e5596f373f9a657)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/SUMMARY.md&commit_hash=2ce482b1c8407332b3b74f4c3e5596f373f9a657) + - [基礎](./00_basic.md) - [文字](./01_literal.md) - [名稱](02_name.md) diff --git a/doc/zh_TW/syntax/container_ownership.md b/doc/zh_TW/syntax/container_ownership.md index 283eb5d3..31392695 100644 --- a/doc/zh_TW/syntax/container_ownership.md +++ b/doc/zh_TW/syntax/container_ownership.md @@ -1,5 +1,7 @@ # 下標(索引訪問) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/container_ownership.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/container_ownership.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + `[]` 不同于普通的方法。 ```python diff --git a/doc/zh_TW/syntax/indexes.md b/doc/zh_TW/syntax/indexes.md index 1ff34807..25fc980e 100644 --- a/doc/zh_TW/syntax/indexes.md +++ b/doc/zh_TW/syntax/indexes.md @@ -1,5 +1,7 @@ # 指數 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/indexes.md%26commit_hash%3D438bcb89ea692f219b30f3a3ba107888b23eae98)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/indexes.md&commit_hash=438bcb89ea692f219b30f3a3ba107888b23eae98) + 有關不在此索引中的 API,請參閱 [此處](../API/index.md)。 有關術語,請參見 [此處](../dev_guide/terms.md)。 diff --git a/doc/zh_TW/syntax/quick_tour.md b/doc/zh_TW/syntax/quick_tour.md index e91bef22..c293b37b 100644 --- a/doc/zh_TW/syntax/quick_tour.md +++ b/doc/zh_TW/syntax/quick_tour.md @@ -1,5 +1,7 @@ # 快速瀏覽 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/quick_tour.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/quick_tour.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + `syntax` 下面的文檔是為了讓編程初學者也能理解而編寫的。 對于已經掌握 Python、Rust、Haskell 等語言的人來說,可能有點啰嗦。 diff --git a/doc/zh_TW/syntax/type/01_type_system.md b/doc/zh_TW/syntax/type/01_type_system.md index 9dabb102..9dcd57e3 100644 --- a/doc/zh_TW/syntax/type/01_type_system.md +++ b/doc/zh_TW/syntax/type/01_type_system.md @@ -1,5 +1,7 @@ # Erg 的類型系統 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/01_type_system.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/01_type_system.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 下面簡單介紹一下 Erg 的類型系統。 詳細信息在其他部分進行說明。 ## 如何定義 diff --git a/doc/zh_TW/syntax/type/02_basic.md b/doc/zh_TW/syntax/type/02_basic.md index addbf3a7..583a8615 100644 --- a/doc/zh_TW/syntax/type/02_basic.md +++ b/doc/zh_TW/syntax/type/02_basic.md @@ -1,5 +1,7 @@ # 類型的基本語法 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/02_basic.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/02_basic.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## 類型規范 在 Erg 中,可以在 `:` 之后指定變量的類型,如下所示。這可以與作業同時完成。 diff --git a/doc/zh_TW/syntax/type/03_trait.md b/doc/zh_TW/syntax/type/03_trait.md index 4059f479..df7f4dee 100644 --- a/doc/zh_TW/syntax/type/03_trait.md +++ b/doc/zh_TW/syntax/type/03_trait.md @@ -1,5 +1,7 @@ # 特質 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/03_trait.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/03_trait.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + Trait 是一種名義類型,它將類型屬性要求添加到記錄類型。 它類似于 Python 中的抽象基類 (ABC),但區別在于能夠執行代數運算。 diff --git a/doc/zh_TW/syntax/type/04_class.md b/doc/zh_TW/syntax/type/04_class.md index 02c17321..80185bb1 100644 --- a/doc/zh_TW/syntax/type/04_class.md +++ b/doc/zh_TW/syntax/type/04_class.md @@ -1,5 +1,7 @@ # Class +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/04_class.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/04_class.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + Erg 中的類大致是一種可以創建自己的元素(實例)的類型。 這是一個簡單類的示例。 diff --git a/doc/zh_TW/syntax/type/05_inheritance.md b/doc/zh_TW/syntax/type/05_inheritance.md index 19ee1501..ab3dc4a0 100644 --- a/doc/zh_TW/syntax/type/05_inheritance.md +++ b/doc/zh_TW/syntax/type/05_inheritance.md @@ -1,5 +1,7 @@ # 繼承 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/05_inheritance.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/05_inheritance.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 繼承允許您定義一個新類,為現有類添加功能或專業化。 繼承類似于包含在特征中。 繼承的類成為原始類的子類型。 diff --git a/doc/zh_TW/syntax/type/06_nst_vs_sst.md b/doc/zh_TW/syntax/type/06_nst_vs_sst.md index 1464f8a1..8e0ecac5 100644 --- a/doc/zh_TW/syntax/type/06_nst_vs_sst.md +++ b/doc/zh_TW/syntax/type/06_nst_vs_sst.md @@ -1,5 +1,7 @@ # 名義子類型與結構子類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/06_nst_vs_sst.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/06_nst_vs_sst.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ```python Months = 0..12 diff --git a/doc/zh_TW/syntax/type/07_patch.md b/doc/zh_TW/syntax/type/07_patch.md index da3f02ef..0cc37292 100644 --- a/doc/zh_TW/syntax/type/07_patch.md +++ b/doc/zh_TW/syntax/type/07_patch.md @@ -1,5 +1,7 @@ # 修補 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/07_patch.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/07_patch.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + Erg 不允許修改現有類型和類。 這意味著,不可能在類中定義額外的方法,也不能執行特化(一種語言特性,單態化多態聲明的類型并定義專用方法,如在 C++ 中)。 但是,在許多情況下,您可能希望向現有類型或類添加功能,并且有一個稱為“修補”的功能允許您執行此操作。 diff --git a/doc/zh_TW/syntax/type/08_value.md b/doc/zh_TW/syntax/type/08_value.md index c4b8986b..0989d081 100644 --- a/doc/zh_TW/syntax/type/08_value.md +++ b/doc/zh_TW/syntax/type/08_value.md @@ -1,5 +1,7 @@ # 值類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/08_value.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/08_value.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 值類型是可以在編譯時評估的 Erg 內置類型,具體來說: ```python diff --git a/doc/zh_TW/syntax/type/09_attributive.md b/doc/zh_TW/syntax/type/09_attributive.md index ec51fae5..726e38ea 100644 --- a/doc/zh_TW/syntax/type/09_attributive.md +++ b/doc/zh_TW/syntax/type/09_attributive.md @@ -1,5 +1,7 @@ # 屬性類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/09_attributive.md%26commit_hash%3Deccd113c1512076c367fb87ea73406f91ff83ba7)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/09_attributive.md&commit_hash=eccd113c1512076c367fb87ea73406f91ff83ba7) + 屬性類型是包含 Record 和 Dataclass、Patch、Module 等的類型。 屬于屬性類型的類型不是值類型。 diff --git a/doc/zh_TW/syntax/type/10_interval.md b/doc/zh_TW/syntax/type/10_interval.md index b699706c..b64290d9 100644 --- a/doc/zh_TW/syntax/type/10_interval.md +++ b/doc/zh_TW/syntax/type/10_interval.md @@ -1,5 +1,7 @@ # 間隔類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/10_interval.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/10_interval.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + `Range` 對象最基本的用途是作為迭代器。 ```python diff --git a/doc/zh_TW/syntax/type/11_enum.md b/doc/zh_TW/syntax/type/11_enum.md index d5d6c2a2..0ece296c 100644 --- a/doc/zh_TW/syntax/type/11_enum.md +++ b/doc/zh_TW/syntax/type/11_enum.md @@ -1,5 +1,7 @@ # 枚舉類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/11_enum.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/11_enum.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + Set 生成的枚舉類型。 枚舉類型可以與類型規范一起使用,但可以通過將它們分類為類或定義修復程序來定義進一步的方法。 diff --git a/doc/zh_TW/syntax/type/12_refinement.md b/doc/zh_TW/syntax/type/12_refinement.md index 410e926b..1bb55f49 100644 --- a/doc/zh_TW/syntax/type/12_refinement.md +++ b/doc/zh_TW/syntax/type/12_refinement.md @@ -1,5 +1,7 @@ # 細化類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/12_refinement.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/12_refinement.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 細化類型是受謂詞表達式約束的類型。 枚舉類型和區間類型是細化類型的語法糖。 細化類型的標準形式是`{Elem: Type | (預)*}`。 這意味著該類型是其元素為滿足 `Pred` 的 `Elem` 的類型。 diff --git a/doc/zh_TW/syntax/type/13_algebraic.md b/doc/zh_TW/syntax/type/13_algebraic.md index 67d6bf97..45739a7c 100644 --- a/doc/zh_TW/syntax/type/13_algebraic.md +++ b/doc/zh_TW/syntax/type/13_algebraic.md @@ -1,5 +1,7 @@ # 代數類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/13_algebraic.md%26commit_hash%3Dc120700585fdb1d655255c8e2817bb13cc8d369e)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/13_algebraic.md&commit_hash=c120700585fdb1d655255c8e2817bb13cc8d369e) + 代數類型是通過將類型視為代數來操作類型而生成的類型。 它們處理的操作包括Union、Intersection、Diff、Complement等。 普通類只能進行Union,其他操作會導致類型錯誤。 @@ -9,7 +11,6 @@ 聯合類型可以為類型提供多種可能性。 顧名思義,它們是由“或”運算符生成的。 一個典型的 Union 是 `Option` 類型。 `Option` 類型是 `T 或 NoneType` 補丁類型,主要表示可能失敗的值。 - ```python IntOrStr = Int or Str assert dict.get("some key") in (Int or NoneType) diff --git a/doc/zh_TW/syntax/type/14_dependent.md b/doc/zh_TW/syntax/type/14_dependent.md index 133b5bf4..b2f226a4 100644 --- a/doc/zh_TW/syntax/type/14_dependent.md +++ b/doc/zh_TW/syntax/type/14_dependent.md @@ -1,5 +1,7 @@ # 依賴類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/14_dependent.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/14_dependent.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 依賴類型是一個特性,可以說是 Erg 的最大特性。 依賴類型是將值作為參數的類型。 普通的多態類型只能將類型作為參數,但依賴類型放寬了這個限制。 diff --git a/doc/zh_TW/syntax/type/15_quantified.md b/doc/zh_TW/syntax/type/15_quantified.md index a80193f5..b0703989 100644 --- a/doc/zh_TW/syntax/type/15_quantified.md +++ b/doc/zh_TW/syntax/type/15_quantified.md @@ -1,5 +1,7 @@ # 類型變量,量化類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/15_quantified.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/15_quantified.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 類型變量是用于例如指定子程序參數類型的變量,它的類型是任意的(不是單態的)。 首先,作為引入類型變量的動機,考慮 `id` 函數,它按原樣返回輸入。 diff --git a/doc/zh_TW/syntax/type/16_subtyping.md b/doc/zh_TW/syntax/type/16_subtyping.md index ebb4a6ae..fe8e4127 100644 --- a/doc/zh_TW/syntax/type/16_subtyping.md +++ b/doc/zh_TW/syntax/type/16_subtyping.md @@ -1,5 +1,7 @@ # 子類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/16_subtyping.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/16_subtyping.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 在 Erg 中,可以使用比較運算符 `<`、`>` 確定類包含。 ```python diff --git a/doc/zh_TW/syntax/type/17_type_casting.md b/doc/zh_TW/syntax/type/17_type_casting.md index 010719ea..fcf0ff37 100644 --- a/doc/zh_TW/syntax/type/17_type_casting.md +++ b/doc/zh_TW/syntax/type/17_type_casting.md @@ -1,5 +1,7 @@ # 投擲 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/17_type_casting.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/17_type_casting.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## 向上轉型 因為 Python 是一種使用鴨子類型的語言,所以沒有強制轉換的概念。沒有必要向上轉型,本質上也沒有向下轉型。 diff --git a/doc/zh_TW/syntax/type/18_mut.md b/doc/zh_TW/syntax/type/18_mut.md index 3bed2c2f..d0d24c7c 100644 --- a/doc/zh_TW/syntax/type/18_mut.md +++ b/doc/zh_TW/syntax/type/18_mut.md @@ -1,5 +1,7 @@ # 可變類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/18_mut.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/18_mut.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + > __Warning__:本節中的信息是舊的并且包含一些錯誤。 默認情況下,Erg 中的所有類型都是不可變的,即它們的內部狀態無法更新。 diff --git a/doc/zh_TW/syntax/type/19_bound.md b/doc/zh_TW/syntax/type/19_bound.md index 54a09032..adf24228 100644 --- a/doc/zh_TW/syntax/type/19_bound.md +++ b/doc/zh_TW/syntax/type/19_bound.md @@ -1,5 +1,7 @@ # 類型綁定 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/19_bound.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/19_bound.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 類型邊界為類型規范添加條件。 實現這一點的函數是守衛(守衛子句)。 此功能可用于函數簽名、匿名函數簽名以及篩選類型。 守衛寫在返回類型之后。 diff --git a/doc/zh_TW/syntax/type/advanced.md b/doc/zh_TW/syntax/type/advanced.md index d4abf310..18a43be3 100644 --- a/doc/zh_TW/syntax/type/advanced.md +++ b/doc/zh_TW/syntax/type/advanced.md @@ -1 +1,2 @@ -下面,我們將討論更高級的類型系統。 初學者不必閱讀所有部分。 \ No newline at end of file +下面,我們將討論更高級的類型系統。 初學者不必閱讀所有部分。[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/syntax/type/advanced/GADTs.md b/doc/zh_TW/syntax/type/advanced/GADTs.md index 4bb7763a..d8887fb4 100644 --- a/doc/zh_TW/syntax/type/advanced/GADTs.md +++ b/doc/zh_TW/syntax/type/advanced/GADTs.md @@ -1,5 +1,7 @@ # 廣義代數數據類型 (GADT) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/GADTs.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/GADTs.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + Erg 可以通過對 Or 類型進行分類來創建廣義代數數據類型 (GADT)。 ```python diff --git a/doc/zh_TW/syntax/type/advanced/_rank2type.md b/doc/zh_TW/syntax/type/advanced/_rank2type.md index f6ab52ee..f506bb75 100644 --- a/doc/zh_TW/syntax/type/advanced/_rank2type.md +++ b/doc/zh_TW/syntax/type/advanced/_rank2type.md @@ -1,5 +1,7 @@ # rank-2 多態性 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/_rank2type.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/_rank2type.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + > __Warning__:本文檔已過時,一般包含錯誤。 Erg 允許您定義接受各種類型的函數,例如 `id|T|(x: T): T = x`,即多相關。 diff --git a/doc/zh_TW/syntax/type/advanced/default_param.md b/doc/zh_TW/syntax/type/advanced/default_param.md index 7348b947..8b2e2e63 100644 --- a/doc/zh_TW/syntax/type/advanced/default_param.md +++ b/doc/zh_TW/syntax/type/advanced/default_param.md @@ -1,5 +1,7 @@ # 帶默認參數的函數類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/default_param.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/default_param.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 首先,讓我們看一個使用默認參數的示例。 ```python diff --git a/doc/zh_TW/syntax/type/advanced/erasure.md b/doc/zh_TW/syntax/type/advanced/erasure.md index 7dbf7ed3..7a4a74c5 100644 --- a/doc/zh_TW/syntax/type/advanced/erasure.md +++ b/doc/zh_TW/syntax/type/advanced/erasure.md @@ -1,5 +1,7 @@ # 類型擦除 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/erasure.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/erasure.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 類型擦除是將類型參數設置為 `_` 并故意丟棄其信息的過程。類型擦除是許多多態語言的特性,但在 Erg 的語法上下文中,將其稱為類型參數擦除更為準確。 類型擦除的最常見示例是 `[T, _]`。數組在編譯時并不總是知道它們的長度。例如,引用命令行參數的 `sys.argv` 的類型為 `[Str, _]`。由于 Erg 的編譯器無法知道命令行參數的長度,因此必須放棄有關其長度的信息。 diff --git a/doc/zh_TW/syntax/type/advanced/existential.md b/doc/zh_TW/syntax/type/advanced/existential.md index e5900b93..b26f02ab 100644 --- a/doc/zh_TW/syntax/type/advanced/existential.md +++ b/doc/zh_TW/syntax/type/advanced/existential.md @@ -1,5 +1,7 @@ # 存在類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/existential.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/existential.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 如果存在對應于?的for-all類型,那么很自然地假設存在對應于?的存在類型。 存在類型并不難。 你已經知道存在類型,只是沒有意識到它本身。 diff --git a/doc/zh_TW/syntax/type/advanced/keyword_param.md b/doc/zh_TW/syntax/type/advanced/keyword_param.md index 313c3903..0fe2254a 100644 --- a/doc/zh_TW/syntax/type/advanced/keyword_param.md +++ b/doc/zh_TW/syntax/type/advanced/keyword_param.md @@ -1,5 +1,7 @@ # 帶有關鍵字參數的函數類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/keyword_param.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/keyword_param.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + ```python h(f) = f(y: 1, x: 2) h: |T: type|((y: Int, x: Int) -> T) -> T diff --git a/doc/zh_TW/syntax/type/advanced/kind.md b/doc/zh_TW/syntax/type/advanced/kind.md index 2cb42a9e..c8c151c2 100644 --- a/doc/zh_TW/syntax/type/advanced/kind.md +++ b/doc/zh_TW/syntax/type/advanced/kind.md @@ -1,5 +1,7 @@ # Kind +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/kind.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/kind.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 一切都在 Erg 中輸入。類型本身也不例外。 __kind__ 表示“類型的類型”。例如,`Int` 屬于 `Type`,就像 `1` 屬于 `Int`。 `Type` 是最簡單的一種,__atomic kind__。在類型論符號中,`Type` 對應于 `*`。 在Kind的概念中,實際上重要的是一種或多種Kind(多項式Kind)。單項類型,例如`Option`,屬于它。一元Kind表示為 `Type -> Type` [1](#1)。諸如 `Array` 或 `Option` 之類的 __container__ 特別是一種以類型作為參數的多項式類型。 diff --git a/doc/zh_TW/syntax/type/advanced/marker_trait.md b/doc/zh_TW/syntax/type/advanced/marker_trait.md index 733173bf..88f13c49 100644 --- a/doc/zh_TW/syntax/type/advanced/marker_trait.md +++ b/doc/zh_TW/syntax/type/advanced/marker_trait.md @@ -1,5 +1,7 @@ # 標記特征 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/marker_trait.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/marker_trait.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 標記特征是沒有必需屬性的特征。 也就是說,您可以在不實現任何方法的情況下實現 Impl。 沒有 required 屬性似乎沒有意義,但由于注冊了它屬于 trait 的信息,因此可以使用 patch 方法或由編譯器進行特殊處理。 diff --git a/doc/zh_TW/syntax/type/advanced/mut_struct.md b/doc/zh_TW/syntax/type/advanced/mut_struct.md index 83ff0c82..ea383304 100644 --- a/doc/zh_TW/syntax/type/advanced/mut_struct.md +++ b/doc/zh_TW/syntax/type/advanced/mut_struct.md @@ -1,5 +1,7 @@ # 可變結構類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/mut_struct.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/mut_struct.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + `T!` 類型被描述為可以被任何 `T` 類型對象替換的盒子類型。 ```python diff --git a/doc/zh_TW/syntax/type/advanced/newtype.md b/doc/zh_TW/syntax/type/advanced/newtype.md index fde9b08d..2b2435d5 100644 --- a/doc/zh_TW/syntax/type/advanced/newtype.md +++ b/doc/zh_TW/syntax/type/advanced/newtype.md @@ -1,5 +1,7 @@ # 新類型模式 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/newtype.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/newtype.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 這是 Rust 中常用的 newtype 模式的 Erg 版本。 Erg 允許定義類型別名如下,但它們只引用相同的類型。 diff --git a/doc/zh_TW/syntax/type/advanced/overloading.md b/doc/zh_TW/syntax/type/advanced/overloading.md index 0cbe405c..10a7c651 100644 --- a/doc/zh_TW/syntax/type/advanced/overloading.md +++ b/doc/zh_TW/syntax/type/advanced/overloading.md @@ -1,5 +1,7 @@ # 重載 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/overloading.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/overloading.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + Erg 不支持 __ad hoc 多態性__。 也就是說,函數和種類(重載)的多重定義是不可能的。 但是,您可以通過使用特征和補丁的組合來重現重載行為。 您可以使用特征而不是特征類,但隨后將涵蓋所有實現 `.add1` 的類型。 @@ -47,7 +49,6 @@ Erg 的立場是,您不能定義行為完全不同的函數,例如根據參 首先,重載函數分布在它們的定義中。 這使得在發生錯誤時很難報告錯誤的原因。 此外,導入子程序可能會改變已定義子程序的行為。 - ```python {id; ...} = import "foo" ... diff --git a/doc/zh_TW/syntax/type/advanced/phantom.md b/doc/zh_TW/syntax/type/advanced/phantom.md index 52fbf2ef..f83b8d02 100644 --- a/doc/zh_TW/syntax/type/advanced/phantom.md +++ b/doc/zh_TW/syntax/type/advanced/phantom.md @@ -1,5 +1,7 @@ # 幻影(phantom)類 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/phantom.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/phantom.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 幻像類型是標記特征,其存在僅用于向編譯器提供注釋。 作為幻像類型的一種用法,讓我們看一下列表的結構。 diff --git a/doc/zh_TW/syntax/type/advanced/projection.md b/doc/zh_TW/syntax/type/advanced/projection.md index 6d295db2..d8661882 100644 --- a/doc/zh_TW/syntax/type/advanced/projection.md +++ b/doc/zh_TW/syntax/type/advanced/projection.md @@ -1,5 +1,7 @@ # 投影類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/projection.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/projection.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 投影類型表示如下代碼中的“Self.AddO”等類型。 ```python diff --git a/doc/zh_TW/syntax/type/advanced/quantified_dependent.md b/doc/zh_TW/syntax/type/advanced/quantified_dependent.md index e9f70a41..aecbe76e 100644 --- a/doc/zh_TW/syntax/type/advanced/quantified_dependent.md +++ b/doc/zh_TW/syntax/type/advanced/quantified_dependent.md @@ -1,5 +1,7 @@ # 量化依賴類型 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/quantified_dependent.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/quantified_dependent.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + Erg 有量化和依賴類型。 那么很自然地,就可以創建一個將兩者結合起來的類型。 那是量化的依賴類型。 ```python diff --git a/doc/zh_TW/syntax/type/advanced/shared.md b/doc/zh_TW/syntax/type/advanced/shared.md index 8de3d6cd..7be09ecc 100644 --- a/doc/zh_TW/syntax/type/advanced/shared.md +++ b/doc/zh_TW/syntax/type/advanced/shared.md @@ -1,5 +1,7 @@ # 共享參考 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/shared.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/shared.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + 共享引用是必須小心處理的語言特性之一。 例如,在 TypeScript 中,以下代碼將通過類型檢查。 diff --git a/doc/zh_TW/syntax/type/advanced/special.md b/doc/zh_TW/syntax/type/advanced/special.md index 43a60d8c..a79890f1 100644 --- a/doc/zh_TW/syntax/type/advanced/special.md +++ b/doc/zh_TW/syntax/type/advanced/special.md @@ -1,5 +1,7 @@ # 特殊類型(Self、Super) +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/special.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/special.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + `Self` 代表它自己的類型。 您可以將其用作別名,但請注意派生類型的含義會發生變化(指的是自己的類型)。 ```python diff --git a/doc/zh_TW/syntax/type/advanced/typeof.md b/doc/zh_TW/syntax/type/advanced/typeof.md index a43da672..ca15b886 100644 --- a/doc/zh_TW/syntax/type/advanced/typeof.md +++ b/doc/zh_TW/syntax/type/advanced/typeof.md @@ -1,5 +1,7 @@ # Typeof, classof +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/typeof.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/typeof.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + `Typeof` 是一個可以窺探 Erg 類型推斷系統的函數,它的行為很復雜 ```python diff --git a/doc/zh_TW/syntax/type/advanced/variance.md b/doc/zh_TW/syntax/type/advanced/variance.md index 6afead62..1124dc38 100644 --- a/doc/zh_TW/syntax/type/advanced/variance.md +++ b/doc/zh_TW/syntax/type/advanced/variance.md @@ -1,5 +1,7 @@ # 變化 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/variance.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/variance.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + Erg 可以對多態類型進行子類型化,但有一些注意事項。 首先,考慮普通多態類型的包含關系。一般來說,有一個容器`K`和它分配的類型`A,B`,當`A < B`時,`K A < K B`。 diff --git a/doc/zh_TW/syntax/type/advanced/widening.md b/doc/zh_TW/syntax/type/advanced/widening.md index 22991331..4f8a11b6 100644 --- a/doc/zh_TW/syntax/type/advanced/widening.md +++ b/doc/zh_TW/syntax/type/advanced/widening.md @@ -1,5 +1,7 @@ # 類型加寬 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/syntax/type/advanced/widening.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/syntax/type/advanced/widening.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + 例如,定義多相關系數如下。 ```python diff --git a/doc/zh_TW/tips.md b/doc/zh_TW/tips.md index 2ce0240b..56d8f484 100644 --- a/doc/zh_TW/tips.md +++ b/doc/zh_TW/tips.md @@ -1,5 +1,7 @@ # 提示 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/tips.md%26commit_hash%3D51de3c9d5a9074241f55c043b9951b384836b258)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tips.md&commit_hash=51de3c9d5a9074241f55c043b9951b384836b258) + ## 想要更改顯示錯誤的語言 請為您的語言下載 Erg。 diff --git a/doc/zh_TW/tools/build.md b/doc/zh_TW/tools/build.md index 2f8fd227..bbc7fa5a 100644 --- a/doc/zh_TW/tools/build.md +++ b/doc/zh_TW/tools/build.md @@ -1,5 +1,7 @@ # 構建子命令 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/tools/build.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/build.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + build 子命令構建包。 默認構建中執行的步驟如下: diff --git a/doc/zh_TW/tools/env.md b/doc/zh_TW/tools/env.md index 44e6f30c..933ff187 100644 --- a/doc/zh_TW/tools/env.md +++ b/doc/zh_TW/tools/env.md @@ -1,5 +1,7 @@ # 環境子命令 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/tools/env.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/env.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + env 子命令指定 erg 執行環境。 使用 `erg env new [env name]` 創建一個新的執行環境。 將打開一個交互式工具,當您指定 erg 版本時,將安裝該版本的 erg(如果已存在,將使用它),您將能夠將其用作新環境。 您可以使用 `erg env switch [env name]` 切換環境。 diff --git a/doc/zh_TW/tools/fmt.md b/doc/zh_TW/tools/fmt.md index a7f9ce90..4f73844c 100644 --- a/doc/zh_TW/tools/fmt.md +++ b/doc/zh_TW/tools/fmt.md @@ -1,5 +1,7 @@ # fmt +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/tools/fmt.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/fmt.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 可以使用 fmt 子命令來完成代碼格式化。 常用的標志有: diff --git a/doc/zh_TW/tools/index.md b/doc/zh_TW/tools/index.md index e69de29b..f08300dc 100644 --- a/doc/zh_TW/tools/index.md +++ b/doc/zh_TW/tools/index.md @@ -0,0 +1,2 @@ +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/tools/index.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/index.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + diff --git a/doc/zh_TW/tools/install.md b/doc/zh_TW/tools/install.md index c8a85230..dec4ce30 100644 --- a/doc/zh_TW/tools/install.md +++ b/doc/zh_TW/tools/install.md @@ -1,5 +1,7 @@ # 安裝子命令 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/tools/install.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/install.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 您可以使用 install 安裝在注冊表站點上注冊的軟件包。 基本用法與cargo等包管理器相同。 diff --git a/doc/zh_TW/tools/pack.md b/doc/zh_TW/tools/pack.md index 8b012a8e..f966688c 100644 --- a/doc/zh_TW/tools/pack.md +++ b/doc/zh_TW/tools/pack.md @@ -1,5 +1,7 @@ # 包管理器 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/tools/pack.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/pack.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + Erg 標配有一個包管理器,您可以使用 `pack` 子命令調用它。 以下是典型的選項。 diff --git a/doc/zh_TW/tools/repl.md b/doc/zh_TW/tools/repl.md index 2f02a483..765b72a7 100644 --- a/doc/zh_TW/tools/repl.md +++ b/doc/zh_TW/tools/repl.md @@ -1,5 +1,7 @@ # REPL +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/tools/repl.md%26commit_hash%3Dd15cbbf7b33df0f78a575cff9679d84c36ea3ab1)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/repl.md&commit_hash=d15cbbf7b33df0f78a575cff9679d84c36ea3ab1) + 運行不帶參數的 `erg` 命令會調用 REPL。 它也可以用 `repl` 子命令調用。 此外,您可以指定以下標志: diff --git a/doc/zh_TW/tools/test.md b/doc/zh_TW/tools/test.md index 237826e8..a5254f27 100644 --- a/doc/zh_TW/tools/test.md +++ b/doc/zh_TW/tools/test.md @@ -1,5 +1,7 @@ # 測試子命令 +[![badge](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fgezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com%2Fdefault%2Fsource_up_to_date%3Fowner%3Derg-lang%26repos%3Derg%26ref%3Dmain%26path%3Ddoc/EN/tools/test.md%26commit_hash%3D06f8edc9e2c0cee34f6396fd7c64ec834ffb5352)](https://gezf7g7pd5.execute-api.ap-northeast-1.amazonaws.com/default/source_up_to_date?owner=erg-lang&repos=erg&ref=main&path=doc/EN/tools/test.md&commit_hash=06f8edc9e2c0cee34f6396fd7c64ec834ffb5352) + erg 命令有一個名為 test 的子命令,它支持測試的實現和執行。 ## 測試裝飾器 (@Test)