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
Copy file name to clipboardExpand all lines: Glossary.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ Here you can find definitions for words that are commonly used in the **compiler
2
2
with links to the codebase. Check https://www.roc-lang.org/tutorial if you want to know
3
3
about general Roc terms. Feel free to ask for a term to be added or add one yourself!
4
4
5
-
Contributor note: definitons should be roughly ordered like in a tutorial, e.g.
5
+
Contributor note: definitions should be roughly ordered like in a tutorial, e.g.
6
6
Parser should be explained before Canonicalization.
7
7
8
8
## CLI
@@ -132,12 +132,28 @@ Desugaring in the compiler:
132
132
133
133
## Type Signature
134
134
135
-
TODO
135
+
Specifies the type of a variable. For example, the type signature of `Str.concat` is:
136
+
```
137
+
concat : Str, Str -> Str
138
+
```
139
+
Here it specifies `concat` takes two strings as input and produces one as output.
140
+
141
+
In the compiler, the type signature specified in the source code has priority over the type found by [type inference](#type-inference), although both need to match for your code to compile completely.
142
+
143
+
Type annotations are basically the same thing as type signatures and both terms are used interchangeably throughout the compiler.
144
+
145
+
Parsing of type signatures:
146
+
- New compiler: [Parser.zig](src/check/parse/Parser.zig) (search signature)
147
+
- Old compiler: [ast.rs](crates/compiler/parse/src/ast.rs) (search TypeAnnotation)
136
148
137
149
## Type Alias
138
150
139
151
TODO
140
152
153
+
## Type Variable
154
+
155
+
TODO
156
+
141
157
## Compiler Phase
142
158
143
159
A compiler phase is a distinct stage in the process the compiler goes through to translate high-level source code into machine code that a computer can execute. Compilers don’t just do this in one big step, they break it down into several phases, each handling a specific task. Some examples of phases: [tokenization](#tokenization), [parsing](#parsing), [code generation](#code-gen),... .
Copy file name to clipboardExpand all lines: design/editor/editor-ideas.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,8 +55,8 @@ e.g. you have a test `calculate_sum_test` that only uses the function `add`, whe
55
55
- I think it could be possible to create a minimal reproduction of a program / block of code / code used by a single test. So for a failing unit test I would expect it to extract imports, the platform, types and functions that are necessary to run only that unit test and put them in a standalone roc project. This would be useful for sharing bugs with library+application authors and colleagues, for profiling or debugging with all "clutter" removed.
56
56
- Ability to share program state at a breakpoint with someone else.
57
57
- For debugging we should aim for maximal useful observability. For example Rust's enum values can not be easily viewed in the CodeLLDB debugger, you actually need to call a print method that does pattern matching to be able to view useful information.
58
-
- We previuously discussed recording full traces of programs so they do not have to be re-run multiple times in the debugging process. We should encourage roc developers to experiment with creating debugging representations of this AST+"execution trace", it could lead to some cool stuff.
59
-
- We previuously mentioned showing expression values next to the code. I think when debugging it would be valuable to focus more on these valuas/data. A possible way to do this would be to create scrollable view(without need to jump between files) of inputs and outputs of user defined functions. Clicking on a function could then show the code with the expression values side by side. Having a good overview of how the values change could make it easy to find where exactly things go wrong.
58
+
- We previously discussed recording full traces of programs so they do not have to be re-run multiple times in the debugging process. We should encourage roc developers to experiment with creating debugging representations of this AST+"execution trace", it could lead to some cool stuff.
59
+
- We previously mentioned showing expression values next to the code. I think when debugging it would be valuable to focus more on these valuas/data. A possible way to do this would be to create scrollable view(without need to jump between files) of inputs and outputs of user defined functions. Clicking on a function could then show the code with the expression values side by side. Having a good overview of how the values change could make it easy to find where exactly things go wrong.
60
60
61
61
- (Machine learning) algorithms to extract and show useful information from debug values.
62
62
- Ability to mark e.g. a specific record field for tracking(filter out the noise) that is being repeatedly updated throughout the program.
@@ -147,7 +147,7 @@ e.g. you have a test `calculate_sum_test` that only uses the function `add`, whe
147
147
- open google/github/duckduckgo search for error...
148
148
- show editor plugins for library X
149
149
- commands to control log filtering
150
-
-collaps all arms of when
150
+
-collapse all arms of when
151
151
- "complex" filtered search: search for all occurrences of `"#` but ignore all like `"#,`
Copy file name to clipboardExpand all lines: design/language/Abilities.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -348,7 +348,7 @@ isNotEq : Dict k v, Dict k v -> Bool
348
348
In this `Eq { isEq, isNotEq }` declaration, I'm saying that `isEq` and `isNotEq` are functions already in scope. I could also choose different names using record literal syntax, e.g. `Eq { isEq: dictIsEq, isNotEq: dictIsNotEq }` - the relevant part is that I'm specifying the names of the functions (which must also be in scope) which specify how `Eq` for Dict should work.
349
349
350
350
Now that I've specified this, when I use `==` on two `Dict` values, this `isEq` function will get run instead of the default `==` implementation. This solves [Problem #3](#problem-3-decoders-are-still-hard-to-learn)!
351
-
I can also write something like has `Num` and provide the relevant functions to obtain a unit-ful number type - which solves [Problem #2](#problem-2-custom-number-types-cant-use-arithmetic-operators).
351
+
I can also write something like has `Num` and provide the relevant functions to obtain a unit-ful number type, which solves [Problem #2](#problem-2-custom-number-types-cant-use-arithmetic-operators).
0 commit comments