@@ -2954,9 +2954,8 @@ analogous to a @code{become} expression in Newsqueak or Alef.} destroys the
2954
2954
current function activation frame and replaces it with an activation frame for
2955
2955
the called function. In other words, @code {be } executes a tail-call. The
2956
2956
syntactic form of a @code {be } expression is therefore limited to @emph {tail
2957
- position }: its argument must be a @emph {call expression }, and it must be the
2958
- last expression in a block.
2959
-
2957
+ position }: its argument must be a @emph {call expression } or a @{ trivial cast}
2958
+ of a @emph {call expression }, and it must be the last expression in a block.
2960
2959
An example of a @code {be } expression:
2961
2960
@example
2962
2961
fn print_loop(n: int) @{
@@ -2971,6 +2970,7 @@ fn print_loop(n: int) @{
2971
2970
2972
2971
The above example executes in constant space, replacing each frame with a new
2973
2972
copy of itself.
2973
+
2974
2974
@end ignore
2975
2975
2976
2976
@@ -3001,6 +3001,7 @@ execution and destroying the iterator frame.
3001
3001
@cindex As expression
3002
3002
@cindex Cast
3003
3003
@cindex Typecast
3004
+ @cindex Trivial cast
3004
3005
3005
3006
Executing an @code {as } expression casts the value on the left-hand side to the
3006
3007
type on the right-hand side.
@@ -3018,6 +3019,10 @@ fn avg(v: [float]) -> float @{
3018
3019
@}
3019
3020
@end example
3020
3021
3022
+ A cast is a @emph {trivial cast } iff the type of the casted expression and the
3023
+ target type are identical after replacing all occurences of @code {int },
3024
+ @code {uint }, @code {float } with their machine type equivalents of the
3025
+ target architecture in both types.
3021
3026
3022
3027
@node Ref.Expr.Fail
3023
3028
@subsection Ref.Expr.Fail
0 commit comments