From 21e8145e83fb54ed77e7631deeee8a7e39b028a3 Mon Sep 17 00:00:00 2001 From: GreasySlug <9619abgoni@gmail.com> Date: Tue, 30 Aug 2022 21:58:09 +0900 Subject: [PATCH 1/5] Update to put badges in syntax doc of EN --- doc/EN/syntax/00_basic.md | 3 +++ doc/EN/syntax/01_literal.md | 3 +++ doc/EN/syntax/02_name.md | 3 +++ doc/EN/syntax/03_declaration.md | 3 +++ doc/EN/syntax/04_function.md | 3 +++ doc/EN/syntax/05_builtin_funcs.md | 3 +++ doc/EN/syntax/06_operator.md | 3 +++ doc/EN/syntax/07_side_effect.md | 3 +++ doc/EN/syntax/08_procedure.md | 3 +++ doc/EN/syntax/09_builtin_procs.md | 3 +++ doc/EN/syntax/10_array.md | 3 +++ doc/EN/syntax/11_tuple.md | 3 +++ doc/EN/syntax/12_dict.md | 3 +++ doc/EN/syntax/13_record.md | 3 +++ doc/EN/syntax/14_set.md | 3 +++ doc/EN/syntax/15_type.md | 3 +++ doc/EN/syntax/16_iterator.md | 3 +++ doc/EN/syntax/17_mutability.md | 3 +++ doc/EN/syntax/18_ownership.md | 3 +++ doc/EN/syntax/19_visibility.md | 3 +++ doc/EN/syntax/20_naming_rule.md | 3 +++ doc/EN/syntax/21_lambda.md | 3 +++ doc/EN/syntax/22_subroutine.md | 3 +++ doc/EN/syntax/23_closure.md | 3 +++ doc/EN/syntax/24_module.md | 3 +++ doc/EN/syntax/25_object_system.md | 3 +++ doc/EN/syntax/26_pattern_matching.md | 3 +++ doc/EN/syntax/27_comprehension.md | 3 +++ doc/EN/syntax/28_spread_syntax.md | 3 +++ doc/EN/syntax/29_decorator.md | 3 +++ doc/EN/syntax/30_error_handling.md | 3 +++ doc/EN/syntax/31_pipeline.md | 3 +++ doc/EN/syntax/32_integration_with_Python.md | 3 +++ doc/EN/syntax/33_package_system.md | 3 +++ doc/EN/syntax/34_generator.md | 3 +++ 35 files changed, 105 insertions(+) diff --git a/doc/EN/syntax/00_basic.md b/doc/EN/syntax/00_basic.md index 56ae7bba..0ca44d53 100644 --- a/doc/EN/syntax/00_basic.md +++ b/doc/EN/syntax/00_basic.md @@ -1,5 +1,8 @@ # 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) + > __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. > diff --git a/doc/EN/syntax/01_literal.md b/doc/EN/syntax/01_literal.md index f8336328..8c3a1672 100644 --- a/doc/EN/syntax/01_literal.md +++ b/doc/EN/syntax/01_literal.md @@ -1,5 +1,8 @@ # 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) + ## Basic Literals ### Int Literal diff --git a/doc/EN/syntax/02_name.md b/doc/EN/syntax/02_name.md index 8b87e4a2..9aaae41f 100644 --- a/doc/EN/syntax/02_name.md +++ b/doc/EN/syntax/02_name.md @@ -1,5 +1,8 @@ # 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) + 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. A variable is defined as follows. diff --git a/doc/EN/syntax/03_declaration.md b/doc/EN/syntax/03_declaration.md index 5ca0efc4..06a6d7d1 100644 --- a/doc/EN/syntax/03_declaration.md +++ b/doc/EN/syntax/03_declaration.md @@ -1,5 +1,8 @@ # 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) + 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. After the assignment, the declaration can be checked to ensure that the type is compatible with the object to which it is assigned. diff --git a/doc/EN/syntax/04_function.md b/doc/EN/syntax/04_function.md index 93db2e89..149ff33d 100644 --- a/doc/EN/syntax/04_function.md +++ b/doc/EN/syntax/04_function.md @@ -1,5 +1,8 @@ # 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) + A function is a block that takes an "argument", processes it, and returns it as a "return value". It is defined as follows. ```erg diff --git a/doc/EN/syntax/05_builtin_funcs.md b/doc/EN/syntax/05_builtin_funcs.md index f0b3075a..a9e6fc12 100644 --- a/doc/EN/syntax/05_builtin_funcs.md +++ b/doc/EN/syntax/05_builtin_funcs.md @@ -1,5 +1,8 @@ # 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) + ## if `if` is a function that changes processing depending on a condition. diff --git a/doc/EN/syntax/06_operator.md b/doc/EN/syntax/06_operator.md index abe81367..7b719336 100644 --- a/doc/EN/syntax/06_operator.md +++ b/doc/EN/syntax/06_operator.md @@ -1,5 +1,8 @@ # 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) + Operators are symbols that represent operations. Operands are things to the (left) right of an operator. Operators are a kind of function, and thus are themselves first-class objects that can be bound to variables. When binding, it is necessary to enclose it with ``. diff --git a/doc/EN/syntax/07_side_effect.md b/doc/EN/syntax/07_side_effect.md index 342cae82..61643a57 100644 --- a/doc/EN/syntax/07_side_effect.md +++ b/doc/EN/syntax/07_side_effect.md @@ -1,5 +1,8 @@ # 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) + 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. ```erg diff --git a/doc/EN/syntax/08_procedure.md b/doc/EN/syntax/08_procedure.md index 44363e46..95847877 100644 --- a/doc/EN/syntax/08_procedure.md +++ b/doc/EN/syntax/08_procedure.md @@ -1,5 +1,8 @@ # 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) + 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). diff --git a/doc/EN/syntax/09_builtin_procs.md b/doc/EN/syntax/09_builtin_procs.md index 5a78d28e..d65d76fc 100644 --- a/doc/EN/syntax/09_builtin_procs.md +++ b/doc/EN/syntax/09_builtin_procs.md @@ -1,5 +1,8 @@ # 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) + ## id! Returns the unique identification number of the object. diff --git a/doc/EN/syntax/10_array.md b/doc/EN/syntax/10_array.md index a3c8c20c..f17157ec 100644 --- a/doc/EN/syntax/10_array.md +++ b/doc/EN/syntax/10_array.md @@ -1,5 +1,8 @@ # 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) + Arrays are the most basic __collection (aggregate)__. A collection is an object that can hold multiple objects inside it. diff --git a/doc/EN/syntax/11_tuple.md b/doc/EN/syntax/11_tuple.md index 75a942c3..881f24ea 100644 --- a/doc/EN/syntax/11_tuple.md +++ b/doc/EN/syntax/11_tuple.md @@ -1,5 +1,8 @@ # 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) + 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. diff --git a/doc/EN/syntax/12_dict.md b/doc/EN/syntax/12_dict.md index 2bbfbfd0..8cf861a1 100644 --- a/doc/EN/syntax/12_dict.md +++ b/doc/EN/syntax/12_dict.md @@ -1,5 +1,8 @@ # 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) + Dict is a collection of key/value pairs. ```erg diff --git a/doc/EN/syntax/13_record.md b/doc/EN/syntax/13_record.md index 8fb4c524..2891500c 100644 --- a/doc/EN/syntax/13_record.md +++ b/doc/EN/syntax/13_record.md @@ -1,5 +1,8 @@ # 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) + 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. diff --git a/doc/EN/syntax/14_set.md b/doc/EN/syntax/14_set.md index b1757c12..c3d5cbb9 100644 --- a/doc/EN/syntax/14_set.md +++ b/doc/EN/syntax/14_set.md @@ -1,5 +1,8 @@ # 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) + A set is an unordered array with no duplicates. ```erg diff --git a/doc/EN/syntax/15_type.md b/doc/EN/syntax/15_type.md index 97b8bad7..1192f947 100644 --- a/doc/EN/syntax/15_type.md +++ b/doc/EN/syntax/15_type.md @@ -1,5 +1,8 @@ # 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) + Types are a very important feature in Erg, so we have a [dedicated section](./type/01_type_system.md). Please see there.
diff --git a/doc/EN/syntax/16_iterator.md b/doc/EN/syntax/16_iterator.md index 302d197b..ef02329f 100644 --- a/doc/EN/syntax/16_iterator.md +++ b/doc/EN/syntax/16_iterator.md @@ -1,5 +1,8 @@ # 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) + An iterator is an object used to retrieve elements of a container. ```erg diff --git a/doc/EN/syntax/17_mutability.md b/doc/EN/syntax/17_mutability.md index e88b87b1..7d5ea449 100644 --- a/doc/EN/syntax/17_mutability.md +++ b/doc/EN/syntax/17_mutability.md @@ -1,5 +1,8 @@ # 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) + 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. diff --git a/doc/EN/syntax/18_ownership.md b/doc/EN/syntax/18_ownership.md index 26b463a0..a6ebd3e4 100644 --- a/doc/EN/syntax/18_ownership.md +++ b/doc/EN/syntax/18_ownership.md @@ -1,5 +1,8 @@ # 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) + 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. diff --git a/doc/EN/syntax/19_visibility.md b/doc/EN/syntax/19_visibility.md index 4c1fef53..7526d755 100644 --- a/doc/EN/syntax/19_visibility.md +++ b/doc/EN/syntax/19_visibility.md @@ -1,5 +1,8 @@ # 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) + 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. For example, a private variable defined in the `foo` module cannot be referenced from another module. diff --git a/doc/EN/syntax/20_naming_rule.md b/doc/EN/syntax/20_naming_rule.md index f729d83e..decb85c1 100644 --- a/doc/EN/syntax/20_naming_rule.md +++ b/doc/EN/syntax/20_naming_rule.md @@ -1,5 +1,8 @@ # 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) + 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. ```erg diff --git a/doc/EN/syntax/21_lambda.md b/doc/EN/syntax/21_lambda.md index 67167106..1e8e4855 100644 --- a/doc/EN/syntax/21_lambda.md +++ b/doc/EN/syntax/21_lambda.md @@ -1,5 +1,8 @@ # 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) + An anonymous function is a syntax for creating function objects on the fly without naming them. ```erg diff --git a/doc/EN/syntax/22_subroutine.md b/doc/EN/syntax/22_subroutine.md index 0128c059..4a14090f 100644 --- a/doc/EN/syntax/22_subroutine.md +++ b/doc/EN/syntax/22_subroutine.md @@ -1,5 +1,8 @@ # 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) + ## Func ```erg diff --git a/doc/EN/syntax/23_closure.md b/doc/EN/syntax/23_closure.md index 3d5040d9..4f65a4fb 100644 --- a/doc/EN/syntax/23_closure.md +++ b/doc/EN/syntax/23_closure.md @@ -1,5 +1,8 @@ # 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) + Erg subroutines have a "closure" feature that captures external variables. ```erg diff --git a/doc/EN/syntax/24_module.md b/doc/EN/syntax/24_module.md index ba586185..14caede6 100644 --- a/doc/EN/syntax/24_module.md +++ b/doc/EN/syntax/24_module.md @@ -1,5 +1,8 @@ # 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) + Erg allows you to think of the file itself as a single record. This is called a module. ```erg: foo.er diff --git a/doc/EN/syntax/25_object_system.md b/doc/EN/syntax/25_object_system.md index 7b85ea6f..ef6bd615 100644 --- a/doc/EN/syntax/25_object_system.md +++ b/doc/EN/syntax/25_object_system.md @@ -1,5 +1,8 @@ # 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) + All data that can be assigned to a variable. The `Object` class has the following attributes. * `. __repr__`: returns a (non-rich) string representation of the object. diff --git a/doc/EN/syntax/26_pattern_matching.md b/doc/EN/syntax/26_pattern_matching.md index 7e96d4c4..93a61638 100644 --- a/doc/EN/syntax/26_pattern_matching.md +++ b/doc/EN/syntax/26_pattern_matching.md @@ -1,5 +1,8 @@ # 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) + ## Patterns Available in Erg ### Variable Pattern diff --git a/doc/EN/syntax/27_comprehension.md b/doc/EN/syntax/27_comprehension.md index 91a9a4b5..933ca5c4 100644 --- a/doc/EN/syntax/27_comprehension.md +++ b/doc/EN/syntax/27_comprehension.md @@ -1,5 +1,8 @@ # 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) + An array can be created by `[expr | (name <- iterable)+ (predicate)*]`, And a set can be created by `{expr | (name <- iterable)+ (predicate)*}`. diff --git a/doc/EN/syntax/28_spread_syntax.md b/doc/EN/syntax/28_spread_syntax.md index 74f54a12..1ecd4cd4 100644 --- a/doc/EN/syntax/28_spread_syntax.md +++ b/doc/EN/syntax/28_spread_syntax.md @@ -1,5 +1,8 @@ # 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) + 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. ```erg diff --git a/doc/EN/syntax/29_decorator.md b/doc/EN/syntax/29_decorator.md index 103d17ce..6eb62ac7 100644 --- a/doc/EN/syntax/29_decorator.md +++ b/doc/EN/syntax/29_decorator.md @@ -1,5 +1,8 @@ # 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) + 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. diff --git a/doc/EN/syntax/30_error_handling.md b/doc/EN/syntax/30_error_handling.md index 1a45a675..444d6bf3 100644 --- a/doc/EN/syntax/30_error_handling.md +++ b/doc/EN/syntax/30_error_handling.md @@ -1,5 +1,8 @@ # 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) + Mainly uses Result type. Erg will throw away Error type objects (not supported at top level). diff --git a/doc/EN/syntax/31_pipeline.md b/doc/EN/syntax/31_pipeline.md index b1ca3566..5d66b706 100644 --- a/doc/EN/syntax/31_pipeline.md +++ b/doc/EN/syntax/31_pipeline.md @@ -1,5 +1,8 @@ # 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) + The pipeline operator is used like this: ``` erg diff --git a/doc/EN/syntax/32_integration_with_Python.md b/doc/EN/syntax/32_integration_with_Python.md index 1948466b..7e539780 100644 --- a/doc/EN/syntax/32_integration_with_Python.md +++ b/doc/EN/syntax/32_integration_with_Python.md @@ -1,5 +1,8 @@ # 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) + ## Export to Python When the Erg script is compiled, a .pyc file is generated, which can simply be imported as a Python module. diff --git a/doc/EN/syntax/33_package_system.md b/doc/EN/syntax/33_package_system.md index dded29be..63f9edf9 100644 --- a/doc/EN/syntax/33_package_system.md +++ b/doc/EN/syntax/33_package_system.md @@ -1,5 +1,8 @@ # 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) + 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 for the lib package is `src/lib.er`. Importing a package is equivalent to importing `lib.er`. diff --git a/doc/EN/syntax/34_generator.md b/doc/EN/syntax/34_generator.md index 1aef8649..d32355d3 100644 --- a/doc/EN/syntax/34_generator.md +++ b/doc/EN/syntax/34_generator.md @@ -1,5 +1,8 @@ # 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) + Generators are special procedures that use the `yield!` procedure in a block. ```erg From 2f89a30335024a46ec0b3f6acc6d5a4b8238b7b0 Mon Sep 17 00:00:00 2001 From: GreasySlug <9619abgoni@gmail.com> Date: Tue, 30 Aug 2022 21:59:19 +0900 Subject: [PATCH 2/5] Update to put badges in type doc of EN --- doc/EN/syntax/type/01_type_system.md | 2 ++ doc/EN/syntax/type/02_basic.md | 2 ++ doc/EN/syntax/type/03_trait.md | 2 ++ doc/EN/syntax/type/04_class.md | 2 ++ doc/EN/syntax/type/05_inheritance.md | 2 ++ doc/EN/syntax/type/06_nst_vs_sst.md | 2 ++ doc/EN/syntax/type/07_patch.md | 2 ++ doc/EN/syntax/type/08_value.md | 2 ++ doc/EN/syntax/type/09_attributive.md | 2 ++ doc/EN/syntax/type/10_interval.md | 2 ++ doc/EN/syntax/type/11_enum.md | 2 ++ doc/EN/syntax/type/12_refinement.md | 2 ++ doc/EN/syntax/type/13_algebraic.md | 2 ++ doc/EN/syntax/type/14_dependent.md | 2 ++ doc/EN/syntax/type/15_quantified.md | 2 ++ doc/EN/syntax/type/16_subtyping.md | 2 ++ doc/EN/syntax/type/17_type_casting.md | 2 ++ doc/EN/syntax/type/18_mut.md | 2 ++ doc/EN/syntax/type/19_bound.md | 2 ++ doc/EN/syntax/type/advanced.md | 3 +++ 20 files changed, 41 insertions(+) diff --git a/doc/EN/syntax/type/01_type_system.md b/doc/EN/syntax/type/01_type_system.md index d45ede30..2ac3c45d 100644 --- a/doc/EN/syntax/type/01_type_system.md +++ b/doc/EN/syntax/type/01_type_system.md @@ -1,5 +1,7 @@ # 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) + The following is a brief description of Erg's type system. Details are explained in other sections. ## How to define diff --git a/doc/EN/syntax/type/02_basic.md b/doc/EN/syntax/type/02_basic.md index 4bfb5af6..69391c21 100644 --- a/doc/EN/syntax/type/02_basic.md +++ b/doc/EN/syntax/type/02_basic.md @@ -1,5 +1,7 @@ # 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) + ## Type specification In Erg, the type of a variable can be specified after `:` as follows. This can be done at the same time as an assignment. diff --git a/doc/EN/syntax/type/03_trait.md b/doc/EN/syntax/type/03_trait.md index 093cb1a9..c837edcc 100644 --- a/doc/EN/syntax/type/03_trait.md +++ b/doc/EN/syntax/type/03_trait.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/syntax/type/04_class.md b/doc/EN/syntax/type/04_class.md index 3aa5e1a3..0fe5d687 100644 --- a/doc/EN/syntax/type/04_class.md +++ b/doc/EN/syntax/type/04_class.md @@ -1,5 +1,7 @@ # 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) + A class in Erg is roughly a type that can create its own elements (instances). Here is an example of a simple class. diff --git a/doc/EN/syntax/type/05_inheritance.md b/doc/EN/syntax/type/05_inheritance.md index 6a6650ac..81a2fb33 100644 --- a/doc/EN/syntax/type/05_inheritance.md +++ b/doc/EN/syntax/type/05_inheritance.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/syntax/type/06_nst_vs_sst.md b/doc/EN/syntax/type/06_nst_vs_sst.md index 8cc422cc..43d0b5ae 100644 --- a/doc/EN/syntax/type/06_nst_vs_sst.md +++ b/doc/EN/syntax/type/06_nst_vs_sst.md @@ -1,5 +1,7 @@ # 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) + ```erg Months = 0..12 diff --git a/doc/EN/syntax/type/07_patch.md b/doc/EN/syntax/type/07_patch.md index a07bef36..68b69ca4 100644 --- a/doc/EN/syntax/type/07_patch.md +++ b/doc/EN/syntax/type/07_patch.md @@ -1,5 +1,7 @@ # 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) + 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++). However, there are many situations where you may want to add feature to an existing type or class, and there is a function called "patching" that allows you to do this. diff --git a/doc/EN/syntax/type/08_value.md b/doc/EN/syntax/type/08_value.md index 21db678b..43ad4544 100644 --- a/doc/EN/syntax/type/08_value.md +++ b/doc/EN/syntax/type/08_value.md @@ -1,5 +1,7 @@ # 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) + Value types are Erg built-in types that can be evaluated at compile time, specifically: ``` erg diff --git a/doc/EN/syntax/type/09_attributive.md b/doc/EN/syntax/type/09_attributive.md index 3098d671..53ebc87d 100644 --- a/doc/EN/syntax/type/09_attributive.md +++ b/doc/EN/syntax/type/09_attributive.md @@ -1,5 +1,7 @@ # 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) + Attribute types are types that contain Record and Dataclass, Patch, Module, etc. Types belonging to attribute types are not value types. diff --git a/doc/EN/syntax/type/10_interval.md b/doc/EN/syntax/type/10_interval.md index 4c71ed4f..ce12b3ae 100644 --- a/doc/EN/syntax/type/10_interval.md +++ b/doc/EN/syntax/type/10_interval.md @@ -1,5 +1,7 @@ # 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) + The most basic use of `Range` objects is as iterator. ```erg diff --git a/doc/EN/syntax/type/11_enum.md b/doc/EN/syntax/type/11_enum.md index f117f652..7b5e6b82 100644 --- a/doc/EN/syntax/type/11_enum.md +++ b/doc/EN/syntax/type/11_enum.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/syntax/type/12_refinement.md b/doc/EN/syntax/type/12_refinement.md index 2aac3db8..a28a7587 100644 --- a/doc/EN/syntax/type/12_refinement.md +++ b/doc/EN/syntax/type/12_refinement.md @@ -1,5 +1,7 @@ # 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) + Refinement type is a type constrained by a predicate expression. Enumeration types and interval types are syntax sugar of refinement types. The standard form of a refinement type is `{Elem: Type | (Pred)*}`. This means that the type is a type whose elements are `Elem` satisfying `Pred`. diff --git a/doc/EN/syntax/type/13_algebraic.md b/doc/EN/syntax/type/13_algebraic.md index f910147a..25378c8a 100644 --- a/doc/EN/syntax/type/13_algebraic.md +++ b/doc/EN/syntax/type/13_algebraic.md @@ -1,5 +1,7 @@ # 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) + 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. Normal classes can only perform Union, and other operations will result in a type error. diff --git a/doc/EN/syntax/type/14_dependent.md b/doc/EN/syntax/type/14_dependent.md index 29ebd717..c6bc4d68 100644 --- a/doc/EN/syntax/type/14_dependent.md +++ b/doc/EN/syntax/type/14_dependent.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/syntax/type/15_quantified.md b/doc/EN/syntax/type/15_quantified.md index 368aaaf5..a62d337e 100644 --- a/doc/EN/syntax/type/15_quantified.md +++ b/doc/EN/syntax/type/15_quantified.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/syntax/type/16_subtyping.md b/doc/EN/syntax/type/16_subtyping.md index 45fb202f..8de4d449 100644 --- a/doc/EN/syntax/type/16_subtyping.md +++ b/doc/EN/syntax/type/16_subtyping.md @@ -1,5 +1,7 @@ # 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) + In Erg, class inclusion can be determined with the comparison operators `<`, `>`. ```erg diff --git a/doc/EN/syntax/type/17_type_casting.md b/doc/EN/syntax/type/17_type_casting.md index 65ef9207..cc1e383e 100644 --- a/doc/EN/syntax/type/17_type_casting.md +++ b/doc/EN/syntax/type/17_type_casting.md @@ -1,5 +1,7 @@ # 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) + ## Upcasting Because Python is a language that uses duck typing, there is no concept of casting. There is no need to upcast, and there is essentially no downcasting. diff --git a/doc/EN/syntax/type/18_mut.md b/doc/EN/syntax/type/18_mut.md index e6a9c083..a3fbdbc5 100644 --- a/doc/EN/syntax/type/18_mut.md +++ b/doc/EN/syntax/type/18_mut.md @@ -1,5 +1,7 @@ # 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) + > __Warning__: The information in this section is out of date and contains some errors. In Erg, by default, all types are immutable, i.e., their internal state cannot be updated. diff --git a/doc/EN/syntax/type/19_bound.md b/doc/EN/syntax/type/19_bound.md index 42de3272..a712689d 100644 --- a/doc/EN/syntax/type/19_bound.md +++ b/doc/EN/syntax/type/19_bound.md @@ -1,5 +1,7 @@ # 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) + 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. The guard is described after the return type. diff --git a/doc/EN/syntax/type/advanced.md b/doc/EN/syntax/type/advanced.md index e0c75aec..0a06cb7c 100644 --- a/doc/EN/syntax/type/advanced.md +++ b/doc/EN/syntax/type/advanced.md @@ -1 +1,4 @@ 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) + From 317b5973c354984891523d14a5e6e8f1cc3923ec Mon Sep 17 00:00:00 2001 From: GreasySlug <9619abgoni@gmail.com> Date: Tue, 30 Aug 2022 22:00:08 +0900 Subject: [PATCH 3/5] Update to put badges in advanced of EN --- doc/EN/syntax/type/advanced/GADTs.md | 2 ++ doc/EN/syntax/type/advanced/default_param.md | 2 ++ doc/EN/syntax/type/advanced/erasure.md | 2 ++ doc/EN/syntax/type/advanced/existential.md | 2 ++ doc/EN/syntax/type/advanced/keyword_param.md | 2 ++ doc/EN/syntax/type/advanced/kind.md | 2 ++ doc/EN/syntax/type/advanced/marker_trait.md | 2 ++ doc/EN/syntax/type/advanced/mut_struct.md | 2 ++ doc/EN/syntax/type/advanced/newtype.md | 2 ++ doc/EN/syntax/type/advanced/overloading.md | 2 ++ doc/EN/syntax/type/advanced/phantom.md | 2 ++ doc/EN/syntax/type/advanced/projection.md | 2 ++ doc/EN/syntax/type/advanced/quiantified_dependent.md | 2 ++ doc/EN/syntax/type/advanced/shared.md | 2 ++ doc/EN/syntax/type/advanced/special.md | 2 ++ 15 files changed, 30 insertions(+) diff --git a/doc/EN/syntax/type/advanced/GADTs.md b/doc/EN/syntax/type/advanced/GADTs.md index 4414d113..760de15f 100644 --- a/doc/EN/syntax/type/advanced/GADTs.md +++ b/doc/EN/syntax/type/advanced/GADTs.md @@ -1,5 +1,7 @@ # 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) + Erg can create Generalized Algebraic Data Types (GADTs) by classifying Or (Union) types. ```erg diff --git a/doc/EN/syntax/type/advanced/default_param.md b/doc/EN/syntax/type/advanced/default_param.md index f1db0d00..7ea9f546 100644 --- a/doc/EN/syntax/type/advanced/default_param.md +++ b/doc/EN/syntax/type/advanced/default_param.md @@ -1,5 +1,7 @@ # 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) + First, let's look at an example of the use of default parameters. ```erg diff --git a/doc/EN/syntax/type/advanced/erasure.md b/doc/EN/syntax/type/advanced/erasure.md index 94f9e01a..9819f44f 100644 --- a/doc/EN/syntax/type/advanced/erasure.md +++ b/doc/EN/syntax/type/advanced/erasure.md @@ -1,5 +1,7 @@ # 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) + 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. The most common example of a type that has been type-erased is `[T, _]`. Arrays are not always known their length at compile-time. For example, `sys.argv`, which refers to command line arguments, is of type `[Str, _]`. Since Erg's compiler has no way of knowing the length of command line arguments, information about their length must be given up. diff --git a/doc/EN/syntax/type/advanced/existential.md b/doc/EN/syntax/type/advanced/existential.md index 5cc1ef99..5ba989f3 100644 --- a/doc/EN/syntax/type/advanced/existential.md +++ b/doc/EN/syntax/type/advanced/existential.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/syntax/type/advanced/keyword_param.md b/doc/EN/syntax/type/advanced/keyword_param.md index debadb33..aab5f8c5 100644 --- a/doc/EN/syntax/type/advanced/keyword_param.md +++ b/doc/EN/syntax/type/advanced/keyword_param.md @@ -1,5 +1,7 @@ # 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) + ```erg h(f) = f(y: 1, x: 2) h: |T: Type|((y: Int, x: Int) -> T) -> T diff --git a/doc/EN/syntax/type/advanced/kind.md b/doc/EN/syntax/type/advanced/kind.md index 9639faf5..be76a827 100644 --- a/doc/EN/syntax/type/advanced/kind.md +++ b/doc/EN/syntax/type/advanced/kind.md @@ -1,5 +1,7 @@ # 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) + 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 `*`. In the concept of kind, what is practically important is one or more kinds (multinomial kind). One-term kind, for example `Option`, belongs to it. A unary kind is represented as `Type -> Type` [1](#1). A __container__ such as `Array` or `Option` is specifically a polynomial kind that takes a type as an argument. diff --git a/doc/EN/syntax/type/advanced/marker_trait.md b/doc/EN/syntax/type/advanced/marker_trait.md index d4c713ff..97bc6655 100644 --- a/doc/EN/syntax/type/advanced/marker_trait.md +++ b/doc/EN/syntax/type/advanced/marker_trait.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/syntax/type/advanced/mut_struct.md b/doc/EN/syntax/type/advanced/mut_struct.md index 6119ca10..bd2350c0 100644 --- a/doc/EN/syntax/type/advanced/mut_struct.md +++ b/doc/EN/syntax/type/advanced/mut_struct.md @@ -1,5 +1,7 @@ # 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) + The ``T!`` type is described as a box type that can be replaced by any ``T`` type object. ```erg diff --git a/doc/EN/syntax/type/advanced/newtype.md b/doc/EN/syntax/type/advanced/newtype.md index bf08c2a0..ef5b5993 100644 --- a/doc/EN/syntax/type/advanced/newtype.md +++ b/doc/EN/syntax/type/advanced/newtype.md @@ -1,5 +1,7 @@ # 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) + Here is the Erg version of the newtype pattern commonly used in Rust. Erg allows type aliases to be defined as follows, but they only refer to the same type. diff --git a/doc/EN/syntax/type/advanced/overloading.md b/doc/EN/syntax/type/advanced/overloading.md index 34d295d9..73f52dd9 100644 --- a/doc/EN/syntax/type/advanced/overloading.md +++ b/doc/EN/syntax/type/advanced/overloading.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/syntax/type/advanced/phantom.md b/doc/EN/syntax/type/advanced/phantom.md index 7e8eb133..7189f30c 100644 --- a/doc/EN/syntax/type/advanced/phantom.md +++ b/doc/EN/syntax/type/advanced/phantom.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/syntax/type/advanced/projection.md b/doc/EN/syntax/type/advanced/projection.md index 262e9b9b..872dec3d 100644 --- a/doc/EN/syntax/type/advanced/projection.md +++ b/doc/EN/syntax/type/advanced/projection.md @@ -1,5 +1,7 @@ # 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) + A projection type represents a type such as ``Self.AddO`` in the following code. ```erg diff --git a/doc/EN/syntax/type/advanced/quiantified_dependent.md b/doc/EN/syntax/type/advanced/quiantified_dependent.md index 28afb5ed..64705057 100644 --- a/doc/EN/syntax/type/advanced/quiantified_dependent.md +++ b/doc/EN/syntax/type/advanced/quiantified_dependent.md @@ -1,5 +1,7 @@ # 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) + 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 diff --git a/doc/EN/syntax/type/advanced/shared.md b/doc/EN/syntax/type/advanced/shared.md index ccc907ae..55ce0d9b 100644 --- a/doc/EN/syntax/type/advanced/shared.md +++ b/doc/EN/syntax/type/advanced/shared.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/syntax/type/advanced/special.md b/doc/EN/syntax/type/advanced/special.md index 118f234c..22632c8e 100644 --- a/doc/EN/syntax/type/advanced/special.md +++ b/doc/EN/syntax/type/advanced/special.md @@ -1,5 +1,7 @@ # 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) + `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). ```erg From fc7a25a8d86c208fb07beb70ccc19e4722c759d3 Mon Sep 17 00:00:00 2001 From: GreasySlug <9619abgoni@gmail.com> Date: Tue, 30 Aug 2022 22:00:34 +0900 Subject: [PATCH 4/5] Update to put badges in dev_guide of EN --- doc/EN/dev_guide/branches.md | 2 ++ doc/EN/dev_guide/build_features.md | 2 ++ doc/EN/dev_guide/directories.md | 2 ++ doc/EN/dev_guide/doc_guideline.md | 2 ++ doc/EN/dev_guide/env.md | 2 ++ doc/EN/dev_guide/i18n_messages.md | 2 ++ doc/EN/dev_guide/rust_code_guideline.md | 2 ++ 7 files changed, 14 insertions(+) diff --git a/doc/EN/dev_guide/branches.md b/doc/EN/dev_guide/branches.md index 48d8db4b..701a6040 100644 --- a/doc/EN/dev_guide/branches.md +++ b/doc/EN/dev_guide/branches.md @@ -1,5 +1,7 @@ # 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) + * 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. ## main diff --git a/doc/EN/dev_guide/build_features.md b/doc/EN/dev_guide/build_features.md index 7bff6503..f468fe2c 100644 --- a/doc/EN/dev_guide/build_features.md +++ b/doc/EN/dev_guide/build_features.md @@ -1,5 +1,7 @@ # `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) + ## debug Put into debug mode. This will log the behavior of Erg internally as it happens. diff --git a/doc/EN/dev_guide/directories.md b/doc/EN/dev_guide/directories.md index f9243370..90d0e14e 100644 --- a/doc/EN/dev_guide/directories.md +++ b/doc/EN/dev_guide/directories.md @@ -1,5 +1,7 @@ # 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) + ```console └─┬ assets: images ├─ CODE_OF_CONDUCT: Code of Conduct diff --git a/doc/EN/dev_guide/doc_guideline.md b/doc/EN/dev_guide/doc_guideline.md index 0d72069f..54489a1b 100644 --- a/doc/EN/dev_guide/doc_guideline.md +++ b/doc/EN/dev_guide/doc_guideline.md @@ -1,5 +1,7 @@ # 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) + Any document that does not follow the rules below is subject to correction. * Always include definitions, meanings, or links to terms that appear for the first time in the document. diff --git a/doc/EN/dev_guide/env.md b/doc/EN/dev_guide/env.md index 6743ea76..b73b12d6 100644 --- a/doc/EN/dev_guide/env.md +++ b/doc/EN/dev_guide/env.md @@ -1,5 +1,7 @@ # 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) + ## Need to install * Rust (installed with rustup) diff --git a/doc/EN/dev_guide/i18n_messages.md b/doc/EN/dev_guide/i18n_messages.md index 7736ce80..d137c141 100644 --- a/doc/EN/dev_guide/i18n_messages.md +++ b/doc/EN/dev_guide/i18n_messages.md @@ -1,5 +1,7 @@ # 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) + 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. diff --git a/doc/EN/dev_guide/rust_code_guideline.md b/doc/EN/dev_guide/rust_code_guideline.md index 163cf848..f98441af 100644 --- a/doc/EN/dev_guide/rust_code_guideline.md +++ b/doc/EN/dev_guide/rust_code_guideline.md @@ -1,5 +1,7 @@ # 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) + ## Local rules * Use `log!` for debugging output (use `println!` etc. for output processing required for release). From 020fa47edd39b86ed44bd8c46822aad6edf1442a Mon Sep 17 00:00:00 2001 From: GreasySlug <9619abgoni@gmail.com> Date: Tue, 30 Aug 2022 22:06:34 +0900 Subject: [PATCH 5/5] Updated to add the badge to files under EN doc" --- doc/EN/faq_general.md | 3 +++ doc/EN/faq_technical.md | 4 ++++ doc/EN/improved_points.md | 3 +++ doc/EN/index.md | 3 +++ doc/EN/migration_from_py.md | 3 +++ doc/EN/tips.md | 3 +++ 6 files changed, 19 insertions(+) diff --git a/doc/EN/faq_general.md b/doc/EN/faq_general.md index 331212e5..2db21856 100644 --- a/doc/EN/faq_general.md +++ b/doc/EN/faq_general.md @@ -1,5 +1,8 @@ # 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) + 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. diff --git a/doc/EN/faq_technical.md b/doc/EN/faq_technical.md index 33fe56ce..57798a04 100644 --- a/doc/EN/faq_technical.md +++ b/doc/EN/faq_technical.md @@ -1,5 +1,9 @@ # 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) + + 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. For more information on how the grammar was determined, see [here](./dev_guide/faq_syntax.md) for the underlying syntax decisions, and [here](./dev_guide/../faq_general.md). diff --git a/doc/EN/improved_points.md b/doc/EN/improved_points.md index dc8f71e0..e328132a 100644 --- a/doc/EN/improved_points.md +++ b/doc/EN/improved_points.md @@ -1,5 +1,8 @@ # 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) + ## Perform static analysis (static type checking, variable and property checking) The benefit of static type checking cannot be emphasized enough now, but checking for the existence of variables and properties is also a part that comes into play quite a bit. diff --git a/doc/EN/index.md b/doc/EN/index.md index 0dab9ad3..54f4472f 100644 --- a/doc/EN/index.md +++ b/doc/EN/index.md @@ -1,5 +1,8 @@ # 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) + ## [API/](./API/index.md) This section describes the specifications of subroutines, types, constants, etc. provided by Erg's built-in or standard libraries. diff --git a/doc/EN/migration_from_py.md b/doc/EN/migration_from_py.md index f039b9ca..01617e43 100644 --- a/doc/EN/migration_from_py.md +++ b/doc/EN/migration_from_py.md @@ -1,5 +1,8 @@ # 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) + ## Want to convert a string to an int, etc Use the `parse` method of the `Str` class. It returns a `Result` type. diff --git a/doc/EN/tips.md b/doc/EN/tips.md index 99dc5709..b60f98bd 100644 --- a/doc/EN/tips.md +++ b/doc/EN/tips.md @@ -1,5 +1,8 @@ # 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) + ## Want to change the language in which errors are displayed Please download Erg for your language.