@@ -683,6 +683,7 @@ The keywords are:
683
683
@item @code {auth }
684
684
@tab @code {unsafe }
685
685
@tab @code {self }
686
+ @tab @code {log }
686
687
@item @code {bind }
687
688
@tab @code {type }
688
689
@tab @code {true }
@@ -727,12 +728,12 @@ The keywords are:
727
728
@tab @code {while }
728
729
@tab @code {break }
729
730
@tab @code {cont }
730
- @tab @code {fail }
731
- @item @code {log }
732
731
@tab @code {note }
732
+ @item @code {assert }
733
733
@tab @code {claim }
734
734
@tab @code {check }
735
735
@tab @code {prove }
736
+ @tab @code {fail }
736
737
@item @code {for }
737
738
@tab @code {each }
738
739
@tab @code {ret }
@@ -1395,7 +1396,7 @@ An example of an implicit-dereference operation performed on box values:
1395
1396
@example
1396
1397
let @@ int x = @@ 10;
1397
1398
let @@ int y = @@ 12;
1398
- check (x + y == 22);
1399
+ assert (x + y == 22);
1399
1400
@end example
1400
1401
1401
1402
Other operations act on box values as single-word-sized address values,
@@ -1887,7 +1888,7 @@ let counter c = counter(1);
1887
1888
1888
1889
c.incr();
1889
1890
c.incr();
1890
- check (c.get() == 3);
1891
+ assert (c.get() == 3);
1891
1892
@end example
1892
1893
1893
1894
There is no @emph {this } or @emph {self } available inside an object's
@@ -2232,9 +2233,9 @@ An example of a tuple type and its use:
2232
2233
@example
2233
2234
type pair = tup(int,str);
2234
2235
let pair p = tup(10,"hello");
2235
- check (p._0 == 10);
2236
+ assert (p._0 == 10);
2236
2237
p._1 = "world";
2237
- check (p._1 == "world");
2238
+ assert (p._1 == "world");
2238
2239
@end example
2239
2240
2240
2241
@@ -2898,6 +2899,8 @@ effects of the expression's evaluation.
2898
2899
* Ref.Expr.Alt :: Expression for complex conditional branching.
2899
2900
* Ref.Expr.Prove :: Expression for static assertion of typestate.
2900
2901
* Ref.Expr.Check :: Expression for dynamic assertion of typestate.
2902
+ * Ref.Expr.Assert :: Expression for halting the program if a
2903
+ boolean condition fails to hold.
2901
2904
* Ref.Expr.IfCheck :: Expression for dynamic testing of typestate.
2902
2905
@end menu
2903
2906
@@ -3068,8 +3071,8 @@ let single_param_fn add4 = bind add(4, _);
3068
3071
3069
3072
let single_param_fn add5 = bind add(_, 5);
3070
3073
3071
- check (add(4,5) == add4(5));
3072
- check (add(4,5) == add5(4));
3074
+ assert (add(4,5) == add4(5));
3075
+ assert (add(4,5) == add5(4));
3073
3076
3074
3077
@end example
3075
3078
@@ -3592,6 +3595,16 @@ if check even(x) @{
3592
3595
@}
3593
3596
@end example
3594
3597
3598
+ @node Ref.Expr.Assert
3599
+ @subsection Ref.Expr.Assert
3600
+ @c * Ref.Expr.Assert:: Expression that halts the program if a boolean condition fails to hold.
3601
+ @cindex Assertions
3602
+
3603
+ An @code {assert } expression is similar to a @code {check } expression, except
3604
+ the condition may be any boolean-typed expression, and the compiler makes no
3605
+ use of the knowledge that the condition holds if the program continues to
3606
+ execute after the @code {assert }.
3607
+
3595
3608
@page
3596
3609
@node Ref.Run
3597
3610
@section Ref.Run
0 commit comments