You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -182,21 +182,21 @@ The [proposed stages of the compiler](https://github.com/emilyaherbert/declarati
182
182
183
183
1. parsing
184
184
2.[AST transformation from the untyped AST to the typeable AST and graph collection](https://github.com/emilyaherbert/declaration-engine-and-collection-context-demo/blob/master/de_cc/src/semantic_analysis/graph_collection/mod.rs)
185
-
- insert instances of `TypeInfo` into the `TypeEngine`
186
-
- insert declarations into the `DeclarationEngine`
187
-
- create the collection context
188
-
- NOT evaluate types in any way
189
-
- NOT create constraints on types or perform type unification
190
-
- NOT resolve instances of custom types
185
+
- insert instances of `TypeInfo` into the `TypeEngine`
186
+
- insert declarations into the `DeclarationEngine`
187
+
- create the collection context
188
+
- NOT evaluate types in any way
189
+
- NOT create constraints on types or perform type unification
- visiting all intraprocedural definitions (struct/enum/function/trait/etc declarations)
193
-
- resolving custom types
194
-
- associating type parameters with generics
195
-
- NOT visiting non-intraprocedural definitions (function bodies are not visited)
192
+
- visiting all intraprocedural definitions (struct/enum/function/trait/etc declarations)
193
+
- resolving custom types
194
+
- associating type parameters with generics
195
+
- NOT visiting non-intraprocedural definitions (function bodies are not visited)
196
196
4.[type inference (+ type checking)](https://github.com/emilyaherbert/declaration-engine-and-collection-context-demo/blob/master/de_cc/src/semantic_analysis/type_inference/mod.rs)
197
-
- visiting all function bodies and expressions
198
-
- resolving custom types
199
-
- monomorphizing as needed
197
+
- visiting all function bodies and expressions
198
+
- resolving custom types
199
+
- monomorphizing as needed
200
200
201
201
## Typeable AST
202
202
@@ -389,11 +389,15 @@ these `TypeId`'s resolve in the `TypeEngine` to concrete types.
389
389
390
390
## Recursive Data Structures
391
391
392
+
<!-- markdown-link-check-disable -->
393
+
392
394
From my understanding, it's impossible to do type inference on truly recursive data structures (i.e. those
393
395
that would be of infinite size) as you need to
394
-
[fulfill these requirements](https://papl.cs.brown.edu/2019/types.html#(part._.Recursive_.Datatype_.Definitions)).
396
+
[fulfill these requirements](<https://papl.cs.brown.edu/2019/types.html#(part._.Recursive_.Datatype_.Definitions)>).
395
397
For example:
396
398
399
+
<!-- markdown-link-check-enable -->
400
+
397
401
```rust
398
402
structData1 {
399
403
other:Data2
@@ -404,9 +408,13 @@ struct Data2 {
404
408
}
405
409
```
406
410
411
+
<!-- markdown-link-check-disable -->
412
+
407
413
In these instances, the compiler performs an [occurs check](https://papl.cs.brown.edu/2019/Type_Inference.html)
408
414
to check whether the same type variable occurs on both sides and, if it does, it produces a compile error.
409
415
416
+
<!-- markdown-link-check-enable -->
417
+
410
418
I propose that we use an occurs check detect to recursive data structures until we fully support an equivalent
411
419
to something like the Rust `Box` type, which would eliminate this problem.
The compiler will follow a "rolling release" scheme, which means that periodically (to be specified) a
22
-
new major version will be released.
22
+
new version will be released.
23
23
24
24
This means that as soon as the compiler reaches version "1.0.0", the next **version** will be "1.1.0"; and
25
25
after that and if needed, the next **patch** would be "1.1.1".
@@ -66,13 +66,13 @@ Each item will follow the template:
66
66
...
67
67
```
68
68
69
-
Inside each section, items will follow the template of a user friendly one line description nad link to the PR.
69
+
Inside each section, items will follow the template of a user friendly one line description and a link to the PR.
70
70
71
71
```
72
72
- Index operator using Index trait [#6356](https://github.com/FuelLabs/sway/pull/6356)
73
73
```
74
74
75
-
Given that all PRs will touch this file, to avoid conflicts and decrease the experience when merging them, we will use "git custom merge driver" (see https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver).
75
+
Given that all PRs will touch this file, to avoid conflicts and decrease the experience when merging them, we will use "git custom merge driver" ([https://git-scm.com/docs/gitattributes#\_defining_a_custom_merge_driver](https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver)).
76
76
77
77
This allows a custom merge strategy to a specific file using ".gitattributes".
78
78
@@ -82,7 +82,7 @@ ReleaseNotes.md merge=union
82
82
83
83
## Breaking changes
84
84
85
-
A breaking change is a difference in functionality from the previous version of the compiler that may require an update to sway code in order for it to compile.
85
+
A breaking change is a difference in functionality from the previous version of the compiler that may require an update to Sway code in order for it to compile.
86
86
87
87
The following changes are defined to be breaking changes and will need to follow the process of being gated by feature flags.
88
88
@@ -95,11 +95,10 @@ The following changes are defined to be breaking changes and will need to follow
95
95
- How `contract method` arguments are encoded;
96
96
- How `log` data is encoded;
97
97
- How `message` data is encoded;
98
-
4. Utilization of new VM opcodes;
99
-
5. IR changes
100
-
6. Receipt parsers to break;
101
-
7. When a compiler feature or a standard library produces different behavior for the same code (semantic changes);
102
-
8. When `storage` is impacted. Particularly addresses.
98
+
4. IR changes;
99
+
5. Receipt parsers to break;
100
+
6. When a compiler feature or a standard library produces different behavior for the same code (semantic changes);
101
+
7. When `storage` is impacted. Particularly addresses.
103
102
104
103
## Feature flags
105
104
@@ -108,7 +107,7 @@ Any complex change that needs to be gated will follow these steps.
108
107
1. A specific GitHub issue labeled with `feature-*` and `track-feature`. This issue should be the umbrella for everything related to this feature;
109
108
2. A preliminary PR enabling the feature flag should be created and linked to the umbrella issue; This PR will enable the feature flag `--experimental <comma-separated-list>` on all tools.
110
109
3. As many PRs will be created and merged as normal;
111
-
4. A chapter inside `Sway Unstable book` will be created and updated as needed;
110
+
4. A chapter inside `Sway Unstable Book` will be created and updated as needed;
112
111
5. When the feature is ready, a closing PR will be created and wait until the feature flag is enabled by default.
113
112
6. On a later date, the feature flag can be removed making the feature the default behavior of the compiler.
114
113
@@ -161,7 +160,7 @@ A special token `*` will mean "all features" in the sense that all features can
161
160
> forc ... --experimental *
162
161
```
163
162
164
-
This is specially useful to control what features are enabled
163
+
This is specially useful to control which features are enabled
@@ -192,7 +191,7 @@ This section contains the suggested guide on how to introduce changes to differe
192
191
193
192
## `sway-features` crate
194
193
195
-
A new crate named `sway-features` will be created and will contain **ALL** features and their metadata. The best suggestion is a macro to define features where enums, documentation, etc... will be generated.
194
+
A new crate named `sway-features` will be created and will contain **ALL** features and their metadata. The best suggestion is a macro to define features where enums, documentation, etc., will be generated.
196
195
197
196
This macro also needs to generate code for the errors and warnings related to each error.
198
197
@@ -219,7 +218,7 @@ To allow as user-friendly error messages as possible, in all possible cases, we
219
218
220
219
After that, the lexer and the parser will mark that an experimental feature was lexed/parsed; and a check will guarantee that no disabled experimental was parsed.
221
220
222
-
The error message will have a message explaining that the feature is experimental and a Github link for more details on the stabilization lifecycle.
221
+
The error message will have a message explaining that the feature is experimental and a GitHub link for more details on the stabilization lifecycle.
223
222
224
223
```rust
225
224
// always parse new syntax
@@ -237,9 +236,9 @@ Formatting should always format new syntax, even when the flag is off. To avoid
237
236
238
237
LSP can take advantage of specific error messages, and suggest users to enable the corresponding feature.
239
238
240
-
## CST, AST and Typed Tree
239
+
## CST, AST, and Typed Tree
241
240
242
-
All trees must always support new features, which means that new nodes will always exist. Their specific behavior, desugaring, etc... will be gated by the experimental feature.
241
+
All trees must always support new features, which means that new nodes will always exist. Their specific behavior, desugaring, etc., will be gated by the experimental feature.
243
242
244
243
More specifically, this means that variants should not be behind compiler flags.
245
244
@@ -304,15 +303,15 @@ These are the sources and stacks used as motivation for this RFC.
0 commit comments