Changes between Version 24 and Version 25 of Fundamentals


Ignore:
Timestamp:
05/15/23 23:09:54 (3 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Fundamentals

    v24 v25  
    203203
    204204
    205 * `$here`
    206 * `$root`
    207 * `$pow(double, double)`
    208 * range literals: An expression of the form `lo .. hi` where `lo` and `hi` are integer expressions, represents the range consisting of the integers `lo`, `lo` + 1, ..., `hi` (in that order).  An expression of the form `lo .. hi # step`, where `lo`, `hi`, and `step` are integer expressions is interpreted as follows. If `step` is positive, it represents the range consisting of `lo`, `lo` + `step`, `lo` + 2 ∗ `step`, …, up to and possibly including `hi`. To be precise, the infinite sequence is intersected with the set of integers less than or equal to `hi`.  If `step` is negative, the expression represents the range consisting of `hi`, `hi` + `step`, `hi` + 2 ∗ `step`, . . ., down to and possibly including `lo`. Precisely, the infinite sequence is intersected with the set of integers greater than or equal to `lo`.
    209 * `$scopeof`
    210 * scope relational expressions:
     205=== `$here`
     206Expression of type `$scope`, evaluating to the dynamic scope in which the evaluation takes place.
     207
     208=== `$root`
     209Constant of type `$scope`, the root dynamic scope.
     210
     211=== Range literals
     212
     213An expression of the form `lo .. hi` where `lo` and `hi` are integer expressions, represents the range consisting of the integers `lo`, `lo` + 1, ..., `hi` (in that order).
     214An expression of the form `lo .. hi # step`, where `lo`, `hi`, and `step` are integer expressions is interpreted as follows.
     215If `step` is positive, it represents the range consisting of `lo`, `lo` + `step`, `lo` + 2 ∗ `step`, …, up to and possibly including `hi`.
     216To be precise, the infinite sequence is intersected with the set of integers less than or equal to `hi`.
     217If `step` is negative, the expression represents the range consisting of `hi`, `hi` + `step`, `hi` + 2 ∗ `step`, . . ., down to and possibly including `lo`.
     218Precisely, the infinite sequence is intersected with the set of integers greater than or equal to `lo`.
     219
     220=== `$scopeof`
     221
     222Given any left-hand-side expression ''expr'', the expression `$scopeof(`''expr''`)` evaluates to the dynamic scope containing the object specified by ''expr''.
     223The following example illustrates the semantics of the `$scopeof` operator. All of the assertions hold:
     224{{{
     225{
     226  $scope s1 = $here;
     227  int x;
     228  double a[10];
     229  {
     230    $scope s2 = $here;
     231    int *p = &x;
     232    double *q = &a[4];
     233    assert($scopeof(x)==s1);
     234    assert($scopeof(p)==s2);
     235    assert($scopeof(*p)==s1);
     236    assert($scopeof(a)==s1);
     237    assert($scopeof(a[5])==s1);
     238    assert($scopeof(q)==s2);
     239    assert($scopeof(*q)==s1);
     240  }
     241}
     242}}}
     243
     244=== Scope relational expressions
     245
     246Let `s1` and `s2` be expressions of type `$scope`. The following are all CIVL-C expressions of boolean type:
     247
     248* `s1 == s2`. Holds iff `s1` and `s2` refer to the same dynamic scope.
     249* `s1 != s2`. Holds iff `s1` and `s2` refer to different dynamic scopes.
     250* `s1 <= s2`. Holds iff `s1` is equal to or a descendant of `s2`, i.e., `s1` is equal to or contained in `s2`.
     251* `s1 < s2`. Holds iff `s1` is a strict descendant of `s2`, i.e., `s1` is contained in `s2` and is not equal to `s2`.
     252* `s1 > s2`. Equivalent to `s2 < s1`.
     253* `s1 >= s2`. Equivalent to `s2 <= s1`.
     254
     255Each of these expressions is erroneous if `s1` or `s2` is undefined.  This error is reported by the model checker.
    211256
    212257
     
    241286* `$yield()`
    242287
     288== Functions and macros
     289
     290=== `$pow(double, double)`
    243291
    244292== Contract Annotations