mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
doc(en): update
This commit is contained in:
parent
0f04d27c0e
commit
d79b242c05
12 changed files with 65 additions and 2 deletions
|
@ -0,0 +1 @@
|
|||
# Class
|
|
@ -0,0 +1 @@
|
|||
# Iterator
|
|
@ -0,0 +1 @@
|
|||
# StrWithLen
|
|
@ -0,0 +1 @@
|
|||
# Type
|
|
@ -0,0 +1 @@
|
|||
# Eq
|
|
@ -0,0 +1 @@
|
|||
# Ord
|
|
@ -0,0 +1 @@
|
|||
# Show
|
|
@ -0,0 +1 @@
|
|||
# subtyping
|
|
@ -0,0 +1 @@
|
|||
# unification
|
54
doc/EN/dev_guide/runtime.md
Normal file
54
doc/EN/dev_guide/runtime.md
Normal file
|
@ -0,0 +1,54 @@
|
|||
# Pythonで実装されているモジュール
|
||||
|
||||
## [_erg_array.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_array.py)
|
||||
|
||||
Defines the `List` class, which is a wrapper for `list`.
|
||||
|
||||
## [_erg_bool.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_bool.py)
|
||||
|
||||
Defines the `Bool` class, which is a wrapper for `Nat` (note that it is not `bool`).
|
||||
|
||||
## [_erg_bytes.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_bytes.py)
|
||||
|
||||
## [_erg_control.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_control.py)
|
||||
|
||||
Defines functions that implement control structures such as `for!`, `if!`, etc.
|
||||
|
||||
## [_erg_converters.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_convertors.py)
|
||||
|
||||
Defines constructors for types like `int` and `str`. Currently, these constructors return `None` on failure.
|
||||
|
||||
## [_erg_dict.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_dict.py)
|
||||
|
||||
Defines the `Dict` class, which is a wrapper for `dict`.
|
||||
|
||||
## [_erg_float.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_float.py)
|
||||
|
||||
## [_erg_in_operator.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_in_operator.py)
|
||||
|
||||
Defines the implementation of the `in` operator. Erg's `in` operator adds type containment checks to the functionality of Python's `in` operator. For example, `1 in Int`, `[1, 2] in [Int; 2]` are possible.
|
||||
|
||||
## [_erg_int.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_int.py)
|
||||
|
||||
## [_erg_mutate.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_mutate_operator.py)
|
||||
|
||||
Defines the implementation of the `!` operator, which mutates objects. For example, it can convert `Int` to `IntMut` (`Int!`). This is essentially just calling the `mutate` method.
|
||||
|
||||
## [_erg_nat.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_nat.py)
|
||||
|
||||
## [_erg_range.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_range.py)
|
||||
|
||||
Defines range objects that appear like `1..3`. These are quite different from the `range` objects returned by Python's `range`, and are semantically closer to Rust's `Range`. They can be used with any sortable objects, not just `Int`.
|
||||
|
||||
## [_erg_result.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_result.py)
|
||||
|
||||
Defines the base class for errors, `Error`.
|
||||
|
||||
## [_erg_set.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_set.py)
|
||||
|
||||
## [_erg_std_prelude.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_std_prelude.py)
|
||||
|
||||
The entry point for the Erg runtime.
|
||||
|
||||
## [_erg_str.py](https://github.com/erg-lang/erg/blob/d1dc1e60e7d4e3333f80ed23c5ead77b5fe47cb2/crates/erg_compiler/lib/std/_erg_str.py)
|
||||
|
|
@ -37,7 +37,7 @@ assert f 1 == 2
|
|||
The function should return the same value for the same arguments, but the assumption is broken.
|
||||
Note that `i` is evaluated only at call time.
|
||||
|
||||
Call `.clone` if you want the contents of the mutable object at the time the function was defined.
|
||||
Call `.copy` if you want the contents of the mutable object at the time the function was defined.
|
||||
|
||||
```python
|
||||
i = !0
|
||||
|
|
|
@ -6,7 +6,7 @@ Because Python is a language that uses duck typing, there is no concept of casti
|
|||
However, Erg is statically typed, so there are times when casting must be done.
|
||||
A simple example is `1 + 2.0`: the `+`(Int, Ratio), or Int(<: Add(Ratio, Ratio)) operation is not defined in the Erg language specification. This is because `Int <: Ratio`, so 1 is upcast to 1.0, an instance of Ratio.
|
||||
|
||||
~~The Erg extended bytecode adds type information to BINARY_ADD, in which case the type information is Ratio-Ratio. In this case, the BINARY_ADD instruction does the casting of Int, so no special instruction specifying the cast is inserted. So, for example, even if you override a method in a child class, if you specify the parent as the type, type coercion is performed and the method is executed in the parent's method (name modification is performed at compile time to refer to the parent's method). The compiler only performs type coercion validation and name modification. The runtime does not cast objects (currently. Cast instructions may be implemented for execution optimization). ~~
|
||||
~~The Erg extended bytecode adds type information to BINARY_ADD, in which case the type information is Ratio-Ratio. In this case, the BINARY_ADD instruction does the casting of Int, so no special instruction specifying the cast is inserted. So, for example, even if you override a method in a child class, if you specify the parent as the type, type coercion is performed and the method is executed in the parent's method (name modification is performed at compile time to refer to the parent's method). The compiler only performs type coercion validation and name modification. The runtime does not cast objects (currently. Cast instructions may be implemented for execution optimization).~~
|
||||
|
||||
```python
|
||||
@Inheritable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue