5.8 Error Codes
5.8.1 RA0000
5.8.2 RA0001
5.8.3 RC0000
5.8.4 RE0000
5.8.5 RE0001
5.8.6 RE0002
5.8.7 RE0003
5.8.8 RE0004
5.8.9 RE0005
5.8.10 RE0006
5.8.11 RE0007
5.8.12 RE0008
5.8.13 RE0009
5.8.14 RE0010
5.8.15 RE0011
5.8.16 RE0012
5.8.17 RE0013
5.8.18 RE0014
5.8.19 RE0015
5.8.20 RE0016
5.8.21 RE0017
5.8.22 RE0018
5.8.23 RE0019
5.8.24 RE0020
5.8.25 RE0021
5.8.26 RE0022
5.8.27 RE0023
5.8.28 RE0024
5.8.29 RE0025
5.8.30 RE0026
5.8.31 RE0027
5.8.32 RE0028
5.8.33 RE0029
5.8.34 RE0030
5.8.35 RE0031
5.8.36 RE0032
5.8.37 RE0033
5.8.38 RE0034
5.8.39 RE0035
5.8.40 RE0036
5.8.41 RE0037
5.8.42 RE0038
5.8.43 RE0039
5.8.44 RE0040
5.8.45 RE0041
5.8.46 RE0042
5.8.47 RE0043
5.8.48 RE0044
5.8.49 RE0045
5.8.50 RE0046
5.8.51 RE0047
5.8.52 RE0048
5.8.53 RE0049
5.8.54 RE0050
5.8.55 RE0051
5.8.56 RE0052
5.8.57 RE0053
5.8.58 RE0054
5.8.59 RE0055
5.8.60 RE0056
5.8.61 RE0057
5.8.62 RE0058
5.8.63 RE0059
5.8.64 RE0060
5.8.65 RE0061
5.8.66 RE0062
5.8.67 RE0063
5.8.68 RE0064
5.8.69 RE0065
5.8.70 RE0066
5.8.71 RE0067
5.8.72 RE0068
5.8.73 RE0069
5.8.74 RE0070
5.8.75 RE0071
5.8.76 RE0072
5.8.77 RE0073
5.8.78 RE0074
5.8.79 RE0075
5.8.80 RE0076
5.8.81 RE0077
5.8.82 RE0078
5.8.83 RE0079
5.8.84 RE0080
5.8.85 RE0081
5.8.86 RE0082
5.8.87 RE0083
5.8.88 RE0084
5.8.89 RE0085
5.8.90 RE0086
5.8.91 RE0087
5.8.92 RE0088
5.8.93 RE0089
5.8.94 RE0090
5.8.95 RE0091
5.8.96 RE0092
5.8.97 RE0093
5.8.98 RE0094
5.8.99 RE0095
5.8.100 RE0096
5.8.101 RE0097
5.8.102 RE0098
5.8.103 RE0099
5.8.104 RE0100
5.8.105 RE0101
5.8.106 RE0102
5.8.107 RE0103
5.8.108 RE0104
5.8.109 RE0105
5.8.110 RE0106
5.8.111 RE0107
5.8.112 RE0108
5.8.113 RE0109
5.8.114 RE0110
5.8.115 RE0111
5.8.116 RE0112
5.8.117 RE0113
5.8.118 RE0114
5.8.119 RE0115
5.8.120 RE0116
5.8.121 RE0117
5.8.122 RE0118
5.8.123 RE0119
5.8.124 RE0120
5.8.125 RE0121
5.8.126 RE0122
5.8.127 RE0123
5.8.128 RE0124
5.8.129 RE0125
5.8.130 REP0000
5.8.131 REP0001
5.8.132 RI0000
5.8.133 RI0001
5.8.134 RI0002
5.8.135 RI0003
5.8.136 RI0004
5.8.137 RL0000
5.8.138 RP0000
5.8.139 RP0001
5.8.140 RP0002
5.8.141 RP0003
5.8.142 RP0004
5.8.143 RP0005
5.8.144 RP0006
5.8.145 RP0007
5.8.146 RP0008
5.8.147 RP0009
5.8.148 RP0010
5.8.149 RP0011
5.8.150 RX0000
5.8.151 RAPI0000
5.8.152 RAPI0001
5.8.153 RAPI0002
5.8.154 RAPI0003
5.8.155 RW0000
5.8.156 RW0001
5.8.157 RW0002
5.8.158 RW0003
5.8.159 RW0004
5.8.160 RW0005
5.8.131 REP0001

This error indicates that a View is set, but never dominates any commits. This means the value the View is set to will never be observable.

For example, the code below attempts to set a loop variable as the value of a View:

export const main = Reach.App(() => {
  const A = Participant('Alice', {
    observe: Fun([], Null)
  });
  const I = View('I', { i: UInt });
  deploy();

  A.publish();

  var [ i ] = [0];
  { }
  invariant (balance() == 0);
  while ( i < 5 ) {
    commit();

    A.interact.observe();
    A.publish();

    I.i.set(i);

    i = i + 1;
    continue;
  }

  commit();
});

The effect of I.i.set(i) is only observable after the next commit in its scope. Since, there are no commits between I.i.set(i) and continue, which is the end of the lexical scope, there is no way to observe the effect of setting I.i.

You can generally fix this error by inserting a commit in the area where you’d like the effect of setting a View to be observable. In the case of a while loop, like the program above, it can be fixed the following way:

export const main = Reach.App(() => {
  const A = Participant('Alice', {
    observe: Fun([], Null)
  });
  const I = View('I', { i: UInt });
  deploy();

  A.publish();

  var [ i ] = [0];
  {
    I.i.set(i);
  }
  invariant (balance() == 0);
  while ( i < 5 ) {
    commit();

    A.interact.observe();
    A.publish();

    i = i + 1;
    continue;
  }

  commit();
});

This change will ensure the View I.i is set to i on every iteration of the loop. Additionally, the continuation of the loop will have I.i set to the last value of the loop variable i.