mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-02 21:44:34 +00:00
fix: bugs with enumeration of vars
This commit is contained in:
parent
b1a9f7bf40
commit
fa2919e824
15 changed files with 107 additions and 94 deletions
|
@ -273,6 +273,13 @@ Option T: Type = T or NoneType
|
|||
Option: Type -> Type
|
||||
```
|
||||
|
||||
Compile-time function parameters must have different names from any constants already defined. If the names are the same, it will be interpreted as a constant pattern.
|
||||
|
||||
```python
|
||||
# Int is not a parameter but a constant (type Int)
|
||||
K Int = None
|
||||
```
|
||||
|
||||
## Appendix: Function Comparison
|
||||
|
||||
Erg does not define `==` for functions. This is because there is no structural equivalence algorithm for functions in general.
|
||||
|
|
|
@ -277,6 +277,13 @@ Option T: Type = T or NoneType
|
|||
Option: Type -> Type
|
||||
```
|
||||
|
||||
コンパイル時関数の仮引数は、既に定義されている如何なる定数とも違う名前である必要があります。名前が被った場合、定数パターンとして解釈されます。
|
||||
|
||||
```python
|
||||
# Intは仮引数ではない。型Intのみを引数にとる関数
|
||||
K Int = None
|
||||
```
|
||||
|
||||
## 付録1: 関数の比較
|
||||
|
||||
Ergでは、関数に`==`が定義されていません。それは関数の構造的な同値性判定アルゴリズムが一般には存在しないためです。
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue