Skip to content

Commit 2addfdd

Browse files
committed
fixed markdown notation in RAP7
1 parent dd06653 commit 2addfdd

File tree

1 file changed

+16
-17
lines changed
  • courses/RascalAmendmentProposals/RAP7

1 file changed

+16
-17
lines changed

courses/RascalAmendmentProposals/RAP7/RAP7.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sidebar_position: 7
1212

1313
## Abstract
1414

15-
The proposal is to disallow assignments (=) into all pattern variables, including those of function parameters and the left-hand side of generators (all pattern variables). This effectively makes all those names \`final\` in Java jargon.
15+
The proposal is to disallow assignments (`=`) into all pattern variables, including those of function parameters and the left-hand side of generators (all pattern variables). This effectively makes all those names `final` in Java jargon.
1616

1717
## Motivation
1818

@@ -32,49 +32,49 @@ The basic motivation is to simplify the programming and analysis of Rascal progr
3232

3333
## Specification
3434

35-
* The static checker should disallow \`x \= exp;\` for all \`x\` introduced as pattern variables; this is the core of the proposal and the rest follows.
35+
* The static checker should disallow `x = exp;` for all `x` introduced as pattern variables; this is the core of the proposal and the rest follows.
3636
* Closures should capture all pattern variables by-value (*or else we would not be able to satisfy the constraint that they are final*)
3737

3838
For example:
3939

4040
int f(int j) {
41-
j \= 0; // error\! Can not assign to pattern variable j
41+
j = 0; // error\! Can not assign to pattern variable j
4242

43-
for (k \<- \[0..9\]) {
44-
k \*= 2; // error Can not assign to pattern variable k
43+
for (k <- [0..9]) {
44+
k *= 2; // error Can not assign to pattern variable k
4545
println(k);
4646
}
4747
}
4848

4949
// prints 0123456789 (and not 999999999 anymore\!):
5050
void testClosureNoState() {
51-
x \= for (int j \<- \[0..10\]) {
51+
x = for (int j <- [0..10]) {
5252
append () { return j; };
5353
}
54-
for (f \<- x) {
54+
for (f <- x) {
5555
print(f());
5656
}
5757
}
5858

5959
// prints 999999999:
6060
void testClosureWithState() {
61-
int state \= \-1;
62-
x \= for (int j \<- \[0..10\]) {
63-
state \= j; // no error, this is a local variable
61+
int state = \-1;
62+
x = for (int j <- [0..10]) {
63+
state = j; // no error, this is a local variable
6464
append () { return state; };
6565
}
66-
for (f \<- x) {
66+
for (f <- x) {
6767
print(f());
6868
}
6969
}
7070

7171
// prints 123456789:
7272
void testClosureWithScopedState() {
73-
x \= for (int j \<- \[0..10\]) {
74-
int state \= j; // no error, this is a local variable
75-
append () { return state; }; // \`state\` is new every loop
73+
x = for (int j <- [0..10]) {
74+
int state = j; // no error, this is a local variable
75+
append () { return state; }; // `state` is new every loop
7676
}
77-
for (f \<- x) {
77+
for (f <- x) {
7878
print(f());
7979
}
8080
}
@@ -103,5 +103,4 @@ For example:
103103
* [https://stackoverflow.com/questions/54278043/box-callback-functions-returning-the-same-string-in-rascal/54278923?r=SearchResults\&s=6|21.5850\#54278923](https://stackoverflow.com/questions/54278043/box-callback-functions-returning-the-same-string-in-rascal/54278923?r=SearchResults&s=6|21.5850#54278923)
104104
* [https://github.com/heathermiller/spores](https://github.com/heathermiller/spores)
105105
* [http://blog.sethladd.com/2012/01/for-loops-in-dart-or-fresh-bindings-for.html](http://blog.sethladd.com/2012/01/for-loops-in-dart-or-fresh-bindings-for.html)
106-
*
107-
106+

0 commit comments

Comments
 (0)