|
@@ -16249,7 +16249,7 @@ not (False if input_int() == 1 else 0)
|
|
|
|
|
|
Languages that allow expressions to produce different kinds of values
|
|
Languages that allow expressions to produce different kinds of values
|
|
are called \emph{polymorphic}, a word composed of the Greek roots
|
|
are called \emph{polymorphic}, a word composed of the Greek roots
|
|
-``poly'', meaning ``many'', and ``morph'', meaning ``shape''. There
|
|
|
|
|
|
+``poly'', meaning ``many'', and ``morphos'', meaning ``form''. There
|
|
are several kinds of polymorphism in programming languages, such as
|
|
are several kinds of polymorphism in programming languages, such as
|
|
subtype polymorphism and parametric
|
|
subtype polymorphism and parametric
|
|
polymorphism~\citep{Cardelli:1985kx}. The kind of polymorphism we
|
|
polymorphism~\citep{Cardelli:1985kx}. The kind of polymorphism we
|
|
@@ -16265,8 +16265,8 @@ given anything else it returns \FALSE{}.
|
|
|
|
|
|
Furthermore, even when primitive operations restrict their inputs to
|
|
Furthermore, even when primitive operations restrict their inputs to
|
|
values of a certain type, this restriction is enforced at runtime
|
|
values of a certain type, this restriction is enforced at runtime
|
|
-instead of during compilation. For example, the following tuple read
|
|
|
|
-operation results in a run-time error because it requires a tuple, not
|
|
|
|
|
|
+instead of during compilation. For example, the following expression
|
|
|
|
+results in a run-time error because referencing a component requires a tuple, not
|
|
a Boolean such as \TRUE{}.
|
|
a Boolean such as \TRUE{}.
|
|
%
|
|
%
|
|
{\if\edition\racketEd
|
|
{\if\edition\racketEd
|
|
@@ -16400,8 +16400,8 @@ The concrete and abstract syntax of \LangDyn{}, our subset of
|
|
\racket{Racket}\python{Python}, is defined in
|
|
\racket{Racket}\python{Python}, is defined in
|
|
Figures~\ref{fig:r7-concrete-syntax} and \ref{fig:r7-syntax}.
|
|
Figures~\ref{fig:r7-concrete-syntax} and \ref{fig:r7-syntax}.
|
|
%
|
|
%
|
|
-There is no type checker for \LangDyn{} because it is not a statically
|
|
|
|
-typed language (it's dynamically typed!).
|
|
|
|
|
|
+There is no type checker for \LangDyn{} because dynamically typed
|
|
|
|
+languages check types at runtime.
|
|
|
|
|
|
The definitional interpreter for \LangDyn{} is presented in
|
|
The definitional interpreter for \LangDyn{} is presented in
|
|
\racket{Figure~\ref{fig:interp-Ldyn}}
|
|
\racket{Figure~\ref{fig:interp-Ldyn}}
|
|
@@ -16460,14 +16460,14 @@ If they are not, a \code{trapped-error} is raised. Recall from
|
|
Section~\ref{sec:interp_Lint} that when a definition interpreter
|
|
Section~\ref{sec:interp_Lint} that when a definition interpreter
|
|
raises a \code{trapped-error} error, the compiled code must also
|
|
raises a \code{trapped-error} error, the compiled code must also
|
|
signal an error by exiting with return code \code{255}. A
|
|
signal an error by exiting with return code \code{255}. A
|
|
-\code{trapped-error} is also raised if the index is not less than
|
|
|
|
|
|
+\code{trapped-error} is also raised if the index is not less than the
|
|
length of the vector.
|
|
length of the vector.
|
|
}
|
|
}
|
|
%
|
|
%
|
|
\python{If they are not, an exception is raised. The compiled code
|
|
\python{If they are not, an exception is raised. The compiled code
|
|
must also signal an error by exiting with return code \code{255}. A
|
|
must also signal an error by exiting with return code \code{255}. A
|
|
- exception is also raised if the index is not less than length of the
|
|
|
|
- tuple.}
|
|
|
|
|
|
+ exception is also raised if the index is not less than the length of the
|
|
|
|
+ tuple or if it is negative.}
|
|
|
|
|
|
\begin{figure}[tbp]
|
|
\begin{figure}[tbp]
|
|
{\if\edition\racketEd
|
|
{\if\edition\racketEd
|