Ver código fonte

add some clarification near the end of 9.6

Andrew Tolmach 4 anos atrás
pai
commit
572c960b62
1 arquivos alterados com 10 adições e 3 exclusões
  1. 10 3
      book.tex

+ 10 - 3
book.tex

@@ -12537,7 +12537,7 @@ then the expression can be removed, so the result is just the
 continuation block. \ocaml{This can almost never happen under our typing restrictions,
   because only \code{Void}-typed expressions can appear in effect position,
   and there are by nature almost all side-effecting.  However, the void
-  value \code{(()} \emph{is} pure, and can be used to construct larger pure
+  value \code{()} \emph{is} pure, and can be used to construct larger pure
   expressions of \code{Void} type.}
 %
 The $\WHILE{\itm{cnd}}{\itm{body}}$ expression is the most interesting
@@ -12556,8 +12556,15 @@ be accomplished using \code{delay}.
 The auxiliary functions for tail, assignment, and predicate positions
 need to be updated. The three new language forms, \code{while},
 \code{set!}, and \code{begin}, can appear in assignment and tail
-positions.  Only \code{begin} may appear in predicate positions; the
-other two have result type \code{Void}.
+positions. Only \code{begin} may appear in predicate positions; the
+other two have result type \code{Void}. \ocaml{In our version,
+  the typing restrictions imply that 
+  \code{while} and \code{:=} \emph{cannot} appear in tail, assignment, or
+  predicate positions. 
+  A \code{seq} \emph{can} appear in any of these three positions, provided
+  that its final sub-expression has an appropriate type
+  (\code{Int} for tail position; \code{Int} or \code{Bool}, as appropriate, for
+  assignment positions; \code{Bool} for predicate positions).}
 
 \ocaml{Note that it should never be necessary to generate a \LangCIf{}
   \code{atom} corresponding to the \LangLoop{} void constant \code{()}.}