mirror of
https://github.com/erg-lang/erg.git
synced 2025-10-02 05:31:11 +00:00
Merge pull request #101 from GreasySlug/feature-put-badges
Fixed up-to-date hash values in badges of EN docs
This commit is contained in:
commit
af3fb6103b
83 changed files with 124 additions and 124 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Branch naming and operation policy
|
# Branch naming and operation policy
|
||||||
|
|
||||||
[](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=bd59088c51941b5336e2115189579171d8086929)
|
[](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=fc7a25a8d86c208fb07beb70ccc19e4722c759d3)
|
||||||
|
|
||||||
* Basically, development is done on a single `main` branch (monorepo development). Create a `feature-*` or `issue-*` branch only if it is difficult to work without a separate branch.
|
* Basically, development is done on a single `main` branch (monorepo development). Create a `feature-*` or `issue-*` branch only if it is difficult to work without a separate branch.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# `erg` build features
|
# `erg` build features
|
||||||
|
|
||||||
[](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=bd59088c51941b5336e2115189579171d8086929)
|
[](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=fc7a25a8d86c208fb07beb70ccc19e4722c759d3)
|
||||||
|
|
||||||
## debug
|
## debug
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Directory Structure of Erg
|
# Directory Structure of Erg
|
||||||
|
|
||||||
[](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=0b54ef3b40923a3480e59b04e8b010b050e3086c)
|
[](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=fc7a25a8d86c208fb07beb70ccc19e4722c759d3)
|
||||||
|
|
||||||
```console
|
```console
|
||||||
└─┬ assets: images
|
└─┬ assets: images
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# format
|
# format
|
||||||
|
|
||||||
[](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=3b9be7ad98476f68859ef0deeb5adb24f4155068)
|
[](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=fc7a25a8d86c208fb07beb70ccc19e4722c759d3)
|
||||||
|
|
||||||
Any document that does not follow the rules below is subject to correction.
|
Any document that does not follow the rules below is subject to correction.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Development Environment
|
# Development Environment
|
||||||
|
|
||||||
[](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=80b0b20936126c4886372b10120b8026aecea98a)
|
[](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=fc7a25a8d86c208fb07beb70ccc19e4722c759d3)
|
||||||
|
|
||||||
## Need to install
|
## Need to install
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Multilingualization of Messages
|
# Multilingualization of Messages
|
||||||
|
|
||||||
[](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=842fe1035323c5962f76ce10c595ce0d90c6bf04)
|
[](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=fc7a25a8d86c208fb07beb70ccc19e4722c759d3)
|
||||||
|
|
||||||
Erg is working on making all messages (start, option, doc, hint, warning, error messages, etc.) multilingual within the language.
|
Erg is working on making all messages (start, option, doc, hint, warning, error messages, etc.) multilingual within the language.
|
||||||
This project is open to anyone without detailed knowledge of Rust or Erg. Your participation is always welcome.
|
This project is open to anyone without detailed knowledge of Rust or Erg. Your participation is always welcome.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Guidelines for Rust code
|
# Guidelines for Rust code
|
||||||
|
|
||||||
[](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=bd59088c51941b5336e2115189579171d8086929)
|
[](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=fc7a25a8d86c208fb07beb70ccc19e4722c759d3)
|
||||||
|
|
||||||
## Local rules
|
## Local rules
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Erg FAQ
|
# Erg FAQ
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=fd4afc4fe1f302e11d48a9168b8aaa6b6d7dfbf4)
|
](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=020fa47edd39b86ed44bd8c46822aad6edf1442a)
|
||||||
|
|
||||||
This FAQ is intended for the general Erg beginner.
|
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
|
For individual (common) technical issues, please refer to [here](./faq_technical.md) for individual (common) technical issues, and
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Technical FAQ
|
# Technical FAQ
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6ddef21fec8da781f9967eaf9c1b13c6a1c5607b)
|
](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=020fa47edd39b86ed44bd8c46822aad6edf1442a)
|
||||||
|
|
||||||
|
|
||||||
This section answers technical questions about using the Erg language. In other words, it contains questions that begin with What or Which, and questions that can be answered with Yes/No.
|
This section answers technical questions about using the Erg language. In other words, it contains questions that begin with What or Which, and questions that can be answered with Yes/No.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Improvements from Python
|
# Improvements from Python
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6ddef21fec8da781f9967eaf9c1b13c6a1c5607b)
|
](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=020fa47edd39b86ed44bd8c46822aad6edf1442a)
|
||||||
|
|
||||||
## Perform static analysis (static type checking, variable and property checking)
|
## Perform static analysis (static type checking, variable and property checking)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Index
|
# Index
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=96132b20f6efb8fab884195f7f5144dc87e20be1)
|
](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=020fa47edd39b86ed44bd8c46822aad6edf1442a)
|
||||||
|
|
||||||
## [API/](./API/index.md)
|
## [API/](./API/index.md)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Tips on migrating from Python to Erg
|
# Tips on migrating from Python to Erg
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=96132b20f6efb8fab884195f7f5144dc87e20be1)
|
](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=020fa47edd39b86ed44bd8c46822aad6edf1442a)
|
||||||
|
|
||||||
## Want to convert a string to an int, etc
|
## Want to convert a string to an int, etc
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Basics
|
# Basics
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=bccb88f8845839b36bc8e0f2f0335f7c6a54dd54)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
> __Info__: This document is incomplete. It has not been proofread (style, correct links, mistranslation, etc.). Also, Erg's syntax may be change destructively during version 0.*, and the documentation may not have been updated accordingly. Please be aware of this beforehand.
|
> __Info__: This document is incomplete. It has not been proofread (style, correct links, mistranslation, etc.). Also, Erg's syntax may be change destructively during version 0.*, and the documentation may not have been updated accordingly. Please be aware of this beforehand.
|
||||||
> If you find any errors in this document, please report then to [here form](https://forms.gle/HtLYRfYzWCAaeTGb6) or [GitHub repo](https://github.com/mtshiba/TheErgBook/issues/new). We would appreciate your suggestions.
|
> If you find any errors in this document, please report then to [here form](https://forms.gle/HtLYRfYzWCAaeTGb6) or [GitHub repo](https://github.com/mtshiba/TheErgBook/issues/new). We would appreciate your suggestions.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Literal
|
# Literal
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
## Basic Literals
|
## Basic Literals
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Variable
|
# Variable
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Variables are a type of algebra; algebra in Erg - sometimes simply referred to as variable if there is no confusion - refers to the feature to name objects and make them referable from elsewhere in the code.
|
Variables are a type of algebra; algebra in Erg - sometimes simply referred to as variable if there is no confusion - refers to the feature to name objects and make them referable from elsewhere in the code.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Declaration
|
# Declaration
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=79a1f4904f563052caeae5127e030420f844cc23)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Declaration is the syntax for specifying the type of variable to be used.
|
Declaration is the syntax for specifying the type of variable to be used.
|
||||||
Declarations can be made anywhere in the code, but declarations alone do not refer to the variables. They must be initialized.
|
Declarations can be made anywhere in the code, but declarations alone do not refer to the variables. They must be initialized.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Function
|
# Function
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=c4b61bb14d6a9affeb55a99c99beabc573604073)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
A function is a block that takes an "argument", processes it, and returns it as a "return value". It is defined as follows.
|
A function is a block that takes an "argument", processes it, and returns it as a "return value". It is defined as follows.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Built-in functions
|
# Built-in functions
|
||||||
|
|
||||||
[
|
[
|
||||||
](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_buildtin_funcs.md&commit_hash=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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_buildtin_funcs.md&commit_hash=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
## if
|
## if
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# operator
|
# operator
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=96132b20f6efb8fab884195f7f5144dc87e20be1)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Operators are symbols that represent operations. Operands are things to the (left) right of an operator.
|
Operators are symbols that represent operations. Operands are things to the (left) right of an operator.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Side effects and procedures
|
# Side effects and procedures
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
We have been neglecting to explain the meaning of the `!`, but now its meaning will finally be revealed. This `!` indicates that this object is a "procedure" with a "side-effect". A procedure is a function with a side-effect.
|
We have been neglecting to explain the meaning of the `!`, but now its meaning will finally be revealed. This `!` indicates that this object is a "procedure" with a "side-effect". A procedure is a function with a side-effect.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Procedures
|
# Procedures
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=96132b20f6efb8fab884195f7f5144dc87e20be1)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Procedures are necessary when dealing with mutable objects, but having a mutable object as an argument does not necessarily make it a procedure.
|
Procedures are necessary when dealing with mutable objects, but having a mutable object as an argument does not necessarily make it a procedure.
|
||||||
Here is a function takes a mutable object (not procedure).
|
Here is a function takes a mutable object (not procedure).
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Built-in procedure
|
# Built-in procedure
|
||||||
|
|
||||||
[
|
[
|
||||||
](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_buildtin_procs.md&commit_hash=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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_buildtin_procs.md&commit_hash=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
## id!
|
## id!
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Array
|
# Array
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6c6afe84d1dc05ee7566b46c12d39b8c49a3acfb)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Arrays are the most basic __collection (aggregate)__.
|
Arrays are the most basic __collection (aggregate)__.
|
||||||
A collection is an object that can hold multiple objects inside it.
|
A collection is an object that can hold multiple objects inside it.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Tuple
|
# Tuple
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Tuples are similar to arrays, but can hold objects of different types.
|
Tuples are similar to arrays, but can hold objects of different types.
|
||||||
Such a collection is called an unequal collection. In contrast, homogeneous collections include arrays, sets, etc.
|
Such a collection is called an unequal collection. In contrast, homogeneous collections include arrays, sets, etc.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Dict
|
# Dict
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=7a2f59795bc983f2fd0daf9732f32d59bd8e9c59)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Dict is a collection of key/value pairs.
|
Dict is a collection of key/value pairs.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Record
|
# Record
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=d0b86d83008bf79091b36763bec5a3f4b9f7c5ec)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
A record is a collection that combines the properties of a Dict accessed by key and a tuple whose access is inspected at compile time.
|
A record is a collection that combines the properties of a Dict accessed by key and a tuple whose access is inspected at compile time.
|
||||||
If you know JavaScript, think of it as a (more enhanced) kind of object literal notation.
|
If you know JavaScript, think of it as a (more enhanced) kind of object literal notation.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Set
|
# Set
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
A set is an unordered array with no duplicates.
|
A set is an unordered array with no duplicates.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# types
|
# types
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=96132b20f6efb8fab884195f7f5144dc87e20be1)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Types are a very important feature in Erg, so we have a [dedicated section](./type/01_type_system.md). Please see there.
|
Types are a very important feature in Erg, so we have a [dedicated section](./type/01_type_system.md). Please see there.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Iterator
|
# Iterator
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=96132b20f6efb8fab884195f7f5144dc87e20be1)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
An iterator is an object used to retrieve elements of a container.
|
An iterator is an object used to retrieve elements of a container.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Mutability
|
# Mutability
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6c6afe84d1dc05ee7566b46c12d39b8c49a3acfb)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
As we have already seen, all Erg variables are immutable. However, Erg objects have the concept of mutability.
|
As we have already seen, all Erg variables are immutable. However, Erg objects have the concept of mutability.
|
||||||
Take the following code as an example.
|
Take the following code as an example.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Ownership System
|
# Ownership System
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=a84ab773d007af040d8ad1854bbeb38d136d9c46)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Since Erg is a language that uses Python as its host language, its method of memory management is dependent on the Python implementation.
|
Since Erg is a language that uses Python as its host language, its method of memory management is dependent on the Python implementation.
|
||||||
Semantically, however, Erg's memory management is different from that of Python. The most noticeable differences appear in the ownership system and the prohibition of circular references.
|
Semantically, however, Erg's memory management is different from that of Python. The most noticeable differences appear in the ownership system and the prohibition of circular references.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Visibility
|
# Visibility
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6c6afe84d1dc05ee7566b46c12d39b8c49a3acfb)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Erg variables have the concept of __visibility__.
|
Erg variables have the concept of __visibility__.
|
||||||
All variables we have seen so far are called __private variables__. These are variables that are invisible to the outside world.
|
All variables we have seen so far are called __private variables__. These are variables that are invisible to the outside world.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Naming Conventions
|
# Naming Conventions
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=3D6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a32a)
|
||||||
|
|
||||||
If a variable is to be used as a constant expression, it must begin with a capital letter. The second and succeeding letters may be in lowercase.
|
If a variable is to be used as a constant expression, it must begin with a capital letter. The second and succeeding letters may be in lowercase.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Anonymous Function
|
# Anonymous Function
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
An anonymous function is a syntax for creating function objects on the fly without naming them.
|
An anonymous function is a syntax for creating function objects on the fly without naming them.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Subroutine Signatures
|
# Subroutine Signatures
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6c6afe84d1dc05ee7566b46c12d39b8c49a3acfb)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
## Func
|
## Func
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Closure
|
# Closure
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Erg subroutines have a "closure" feature that captures external variables.
|
Erg subroutines have a "closure" feature that captures external variables.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# module
|
# module
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=0c3f19f27ac0f39b82db2d7e17e746b651895778)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Erg allows you to think of the file itself as a single record. This is called a module.
|
Erg allows you to think of the file itself as a single record. This is called a module.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Object
|
# Object
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6c6afe84d1dc05ee7566b46c12d39b8c49a3acfb)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
All data that can be assigned to a variable. The `Object` class has the following attributes.
|
All data that can be assigned to a variable. The `Object` class has the following attributes.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Pattern matching, Irrefutability
|
# Pattern matching, Irrefutability
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
## Patterns Available in Erg
|
## Patterns Available in Erg
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Comprehension
|
# Comprehension
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
An array can be created by `[expr | (name <- iterable)+ (predicate)*]`,
|
An array can be created by `[expr | (name <- iterable)+ (predicate)*]`,
|
||||||
And a set can be created by `{expr | (name <- iterable)+ (predicate)*}`.
|
And a set can be created by `{expr | (name <- iterable)+ (predicate)*}`.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Spread assignment
|
# Spread assignment
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
In a spread assignment, a variable can be prefixed with `...` in front of the variable, all the remaining elements can be expanded into the variable. This is called a spread assignment.
|
In a spread assignment, a variable can be prefixed with `...` in front of the variable, all the remaining elements can be expanded into the variable. This is called a spread assignment.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Decorator
|
# Decorator
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Decorators are used to add or make explicit a specific state or behavior for a type or function.
|
Decorators are used to add or make explicit a specific state or behavior for a type or function.
|
||||||
The syntax for decorators is as follows.
|
The syntax for decorators is as follows.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Error Handling
|
# Error Handling
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Mainly uses Result type.
|
Mainly uses Result type.
|
||||||
Erg will throw away Error type objects (not supported at top level).
|
Erg will throw away Error type objects (not supported at top level).
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Pipeline Operator
|
# Pipeline Operator
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=a84ab773d007af040d8ad1854bbeb38d136d9c46)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
The pipeline operator is used like this:
|
The pipeline operator is used like this:
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Integration with Python
|
# Integration with Python
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=7270b3f1541be0422fc46e1f533259738333c7d1)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
## Export to Python
|
## Export to Python
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Package System
|
# Package System
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Erg packages can be roughly classified into the app package, which is the application, and the lib package, which is the library.
|
Erg packages can be roughly classified into the app package, which is the application, and the lib package, which is the library.
|
||||||
The entry point of the app package is `src/app.er`. The `main` function defined in `app.er` is executed.
|
The entry point of the app package is `src/app.er`. The `main` function defined in `app.er` is executed.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Generator
|
# Generator
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=6dc8c5015b6120497a26d80eaef65d23eb2bee2a)
|
](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=21e8145e83fb54ed77e7631deeee8a7e39b028a3)
|
||||||
|
|
||||||
Generators are special procedures that use the `yield!` procedure in a block.
|
Generators are special procedures that use the `yield!` procedure in a block.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Erg's Type System
|
# Erg's Type System
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
The following is a brief description of Erg's type system. Details are explained in other sections.
|
The following is a brief description of Erg's type system. Details are explained in other sections.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Basic syntax for types
|
# Basic syntax for types
|
||||||
|
|
||||||
[](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=7c27021e16bea953bdc4da8e0c60e2f3b1ad8571)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
## Type specification
|
## Type specification
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Trait
|
# Trait
|
||||||
|
|
||||||
[](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=7c27021e16bea953bdc4da8e0c60e2f3b1ad8571)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
Trait is a nominal type that adds a type attribute requirement to record types.
|
Trait is a nominal type that adds a type attribute requirement to record types.
|
||||||
It is similar to the Abstract Base Class (ABC) in Python, but with the distinction of being able to perform algebraic operations.
|
It is similar to the Abstract Base Class (ABC) in Python, but with the distinction of being able to perform algebraic operations.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Class
|
# Class
|
||||||
|
|
||||||
[](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=18591823f1781e3f2b6e7ed80ca57ccd39a76c7a)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
A class in Erg is roughly a type that can create its own elements (instances).
|
A class in Erg is roughly a type that can create its own elements (instances).
|
||||||
Here is an example of a simple class.
|
Here is an example of a simple class.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Inheritance
|
# Inheritance
|
||||||
|
|
||||||
[](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=d0b86d83008bf79091b36763bec5a3f4b9f7c5ec)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
Inheritance allows you to define a new class that adds functionality or specialization to an existing class.
|
Inheritance allows you to define a new class that adds functionality or specialization to an existing class.
|
||||||
Inheritance is similar to inclusion in a trace. The inherited class becomes a subtype of the original class.
|
Inheritance is similar to inclusion in a trace. The inherited class becomes a subtype of the original class.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Nominal Subtyping vs. Structural Subtyping
|
# Nominal Subtyping vs. Structural Subtyping
|
||||||
|
|
||||||
[](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=d0b86d83008bf79091b36763bec5a3f4b9f7c5ec)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
```erg
|
```erg
|
||||||
Months = 0..12
|
Months = 0..12
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Patch
|
# Patch
|
||||||
|
|
||||||
[](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=d0b86d83008bf79091b36763bec5a3f4b9f7c5ec)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
Erg does not allow modification of existing types and classes.
|
Erg does not allow modification of existing types and classes.
|
||||||
This means, it is not possible to define additional methods in a class, nor to perform specialization (a language feature that monomorphizes a polymorphically declared type and defines a dedicated method, as in C++).
|
This means, it is not possible to define additional methods in a class, nor to perform specialization (a language feature that monomorphizes a polymorphically declared type and defines a dedicated method, as in C++).
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Value Type
|
# Value Type
|
||||||
|
|
||||||
[](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=HASH_TEMPLATE)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
Value types are Erg built-in types that can be evaluated at compile time, specifically:
|
Value types are Erg built-in types that can be evaluated at compile time, specifically:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Attributive Type
|
# Attributive Type
|
||||||
|
|
||||||
[](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=ae6d00168c17428bf967e44db3e6360e2471df8b)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
Attribute types are types that contain Record and Dataclass, Patch, Module, etc.
|
Attribute types are types that contain Record and Dataclass, Patch, Module, etc.
|
||||||
Types belonging to attribute types are not value types.
|
Types belonging to attribute types are not value types.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Interval Type
|
# Interval Type
|
||||||
|
|
||||||
[](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=ae6d00168c17428bf967e44db3e6360e2471df8b)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
The most basic use of `Range` objects is as iterator.
|
The most basic use of `Range` objects is as iterator.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Enumerative Type
|
# Enumerative Type
|
||||||
|
|
||||||
[](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=ae6d00168c17428bf967e44db3e6360e2471df8b)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
Enum types generated by Set.
|
Enum types generated by Set.
|
||||||
Enum types can be used as-is with type specifications, but further methods can be defined by classifying them into classes or defining patches.
|
Enum types can be used as-is with type specifications, but further methods can be defined by classifying them into classes or defining patches.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Refinement Type
|
# Refinement Type
|
||||||
|
|
||||||
[](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=96132b20f6efb8fab884195f7f5144dc87e20be1)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
Refinement type is a type constrained by a predicate expression. Enumeration types and interval types are syntax sugar of refinement types.
|
Refinement type is a type constrained by a predicate expression. Enumeration types and interval types are syntax sugar of refinement types.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Algebraic type
|
# Algebraic type
|
||||||
|
|
||||||
[](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=ae6d00168c17428bf967e44db3e6360e2471df8b)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
Algebraic types are types that are generated by operating types by treating them like algebra.
|
Algebraic types are types that are generated by operating types by treating them like algebra.
|
||||||
Operations handled by them include Union, Intersection, Diff, Complement, and so on.
|
Operations handled by them include Union, Intersection, Diff, Complement, and so on.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Dependent Types
|
# Dependent Types
|
||||||
|
|
||||||
[](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=96132b20f6efb8fab884195f7f5144dc87e20be1)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
Dependent types are one of the most important features of Erg.
|
Dependent types are one of the most important features of Erg.
|
||||||
Dependent types are types that take values as arguments. Normal polymorphic types can take only types as arguments, but dependent types loosen that restriction.
|
Dependent types are types that take values as arguments. Normal polymorphic types can take only types as arguments, but dependent types loosen that restriction.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Type Variable, quantified type
|
# Type Variable, quantified type
|
||||||
|
|
||||||
[](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=96132b20f6efb8fab884195f7f5144dc87e20be1)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
A type variable is a variable used, for example, to specify the type of subroutine arguments, and its type is arbitrary (not monomorphic).
|
A type variable is a variable used, for example, to specify the type of subroutine arguments, and its type is arbitrary (not monomorphic).
|
||||||
First, as motivation for introducing type variables, consider the `id` function, which returns input as is.
|
First, as motivation for introducing type variables, consider the `id` function, which returns input as is.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Subtyping
|
# Subtyping
|
||||||
|
|
||||||
[](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=2ce482b1c8407332b3b74f4c3e5596f373f9a657)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
In Erg, class inclusion can be determined with the comparison operators `<`, `>`.
|
In Erg, class inclusion can be determined with the comparison operators `<`, `>`.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Cast
|
# Cast
|
||||||
|
|
||||||
[](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=2ce482b1c8407332b3b74f4c3e5596f373f9a657)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
## Upcasting
|
## Upcasting
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Mutable Type
|
# Mutable Type
|
||||||
|
|
||||||
[](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=c4d2f5f4f83d8c3236fda57d14c3b375d438098f)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
> __Warning__: The information in this section is out of date and contains some errors.
|
> __Warning__: The information in this section is out of date and contains some errors.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Type Bound
|
# Type Bound
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
A type boundary is a condition on the type specification. The guard (guard clause) is the function that makes this possible.
|
A type boundary is a condition on the type specification. The guard (guard clause) is the function that makes this possible.
|
||||||
In addition to function signatures and anonymous function signatures, sieve types can also use this feature.
|
In addition to function signatures and anonymous function signatures, sieve types can also use this feature.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
The following sections describe more advanced type systems. Beginners do not need to read the entire section.
|
The following sections describe more advanced type systems. Beginners do not need to read the entire section.
|
||||||
|
|
||||||
[](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=2ce482b1c8407332b3b74f4c3e5596f373f9a657)
|
[](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=2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Generalized Algebraic Data Types (GADTs)
|
# Generalized Algebraic Data Types (GADTs)
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
Erg can create Generalized Algebraic Data Types (GADTs) by classifying Or (Union) types.
|
Erg can create Generalized Algebraic Data Types (GADTs) by classifying Or (Union) types.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Function type with default parameter
|
# Function type with default parameter
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
First, let's look at an example of the use of default parameters.
|
First, let's look at an example of the use of default parameters.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Type erasure
|
# Type erasure
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
Type erasure is the process of setting a type argument to `_` and deliberately discarding its information. Type erasure is a feature of many polymorphic languages, but in the context of Erg's syntax, it is more accurate to call it type argument erasure.
|
Type erasure is the process of setting a type argument to `_` and deliberately discarding its information. Type erasure is a feature of many polymorphic languages, but in the context of Erg's syntax, it is more accurate to call it type argument erasure.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Existential type
|
# Existential type
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
If there is a for-all type corresponding to ∀, it is natural to assume that there is an existential type corresponding to ∃.
|
If there is a for-all type corresponding to ∀, it is natural to assume that there is an existential type corresponding to ∃.
|
||||||
Existential types are not difficult. You already know the existential type, just not consciously aware of it as such.
|
Existential types are not difficult. You already know the existential type, just not consciously aware of it as such.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Function type with keyword arguments
|
# Function type with keyword arguments
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
```erg
|
```erg
|
||||||
h(f) = f(y: 1, x: 2)
|
h(f) = f(y: 1, x: 2)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Kind
|
# Kind
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
Everything is typed in Erg. Types themselves are no exception. __kind__ represents the “type of type”. For example, `Int` belongs to `Type`, just as `1` belongs to `Int`. `Type` is the simplest kind, the __atomic kind__. In type-theoretic notation, `Type` corresponds to `*`.
|
Everything is typed in Erg. Types themselves are no exception. __kind__ represents the “type of type”. For example, `Int` belongs to `Type`, just as `1` belongs to `Int`. `Type` is the simplest kind, the __atomic kind__. In type-theoretic notation, `Type` corresponds to `*`.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Marker Trait
|
# Marker Trait
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
A marker trait is a trait with no required attributes. That is, it can be Impl without implementing a method.
|
A marker trait is a trait with no required attributes. That is, it can be Impl without implementing a method.
|
||||||
It may seem meaningless without the required attribute, but it registers the information that it belongs to that trait, so that patch methods can be used and the compiler can give it special treatment.
|
It may seem meaningless without the required attribute, but it registers the information that it belongs to that trait, so that patch methods can be used and the compiler can give it special treatment.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Mutable Structure Type
|
# Mutable Structure Type
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
The ``T!`` type is described as a box type that can be replaced by any ``T`` type object.
|
The ``T!`` type is described as a box type that can be replaced by any ``T`` type object.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Newtype pattern
|
# Newtype pattern
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
Here is the Erg version of the newtype pattern commonly used in Rust.
|
Here is the Erg version of the newtype pattern commonly used in Rust.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Overloading
|
# Overloading
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
Erg does not support __ad hoc polymorphism__. That is, multiple definitions of functions and Kinds (overloading) are not possible. However, you can reproduce the overloading behavior by using a combination of a trace class and a patch.
|
Erg does not support __ad hoc polymorphism__. That is, multiple definitions of functions and Kinds (overloading) are not possible. However, you can reproduce the overloading behavior by using a combination of a trace class and a patch.
|
||||||
You can use traits instead of trait classes, but then all types that implement `.add1` will be covered.
|
You can use traits instead of trait classes, but then all types that implement `.add1` will be covered.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Phantom class
|
# Phantom class
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
Phantom types are marker traits that exist only to provide annotations to the compiler.
|
Phantom types are marker traits that exist only to provide annotations to the compiler.
|
||||||
As a usage of phantom types, let's look at the structure of a list.
|
As a usage of phantom types, let's look at the structure of a list.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Projection Type
|
# Projection Type
|
||||||
|
|
||||||
[](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=417bfcea08ed0e09f715f5d272842510fca8f6dd)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
A projection type represents a type such as ``Self.AddO`` in the following code.
|
A projection type represents a type such as ``Self.AddO`` in the following code.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Quantified Dependent Type
|
# Quantified Dependent Type
|
||||||
|
|
||||||
[](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/quiantified_dependent.md&commit_hash=d74df7d22b021da0588ee1dad78582f13685c047)
|
[](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/quiantified_dependent.md&commit_hash=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
Erg has quantified and dependent types. Then naturally, it is possible to create a type that combines the two. That is the quantified dependent type.
|
Erg has quantified and dependent types. Then naturally, it is possible to create a type that combines the two. That is the quantified dependent type.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Shared Reference
|
# Shared Reference
|
||||||
|
|
||||||
[](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=ae6d00168c17428bf967e44db3e6360e2471df8b)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
Shared references are one of those language features that must be handled with care.
|
Shared references are one of those language features that must be handled with care.
|
||||||
In TypeScript, for example, the following code will pass type checking.
|
In TypeScript, for example, the following code will pass type checking.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Special Type(Self, Super)
|
# Special Type(Self, Super)
|
||||||
|
|
||||||
[](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=ae6d00168c17428bf967e44db3e6360e2471df8b)
|
[](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=317b5973c354984891523d14a5e6e8f1cc3923ec)
|
||||||
|
|
||||||
`Self` represents itself types. It can be used simply as an alias, however note that its meaning changes in derived types (it refers to the derived own type).
|
`Self` represents itself types. It can be used simply as an alias, however note that its meaning changes in derived types (it refers to the derived own type).
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Tips
|
# Tips
|
||||||
|
|
||||||
[
|
[
|
||||||
](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=96132b20f6efb8fab884195f7f5144dc87e20be1)
|
](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=020fa47edd39b86ed44bd8c46822aad6edf1442a)
|
||||||
|
|
||||||
## Want to change the language in which errors are displayed
|
## Want to change the language in which errors are displayed
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue