From 8d76710993747acbd65c300d7607ba711b3584f0 Mon Sep 17 00:00:00 2001 From: Trevor Hullinger Date: Fri, 22 Apr 2016 07:26:39 -0600 Subject: [PATCH 1/2] Update parameter definitions --- CPSL.tex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CPSL.tex b/CPSL.tex index 720df8b..0954a67 100644 --- a/CPSL.tex +++ b/CPSL.tex @@ -381,8 +381,10 @@ \subsection{For} Either in an monotonically increasing or decreasing fashion depending on whether the keyword to or downto was used. For each value of the new variable a list of statements is executed. \section{Function and Procedure Calls} \subsection{Parameters} -Parameters in CPSL are always passed by value. -No function or procedure can have side effects, except for output or through global variables. +Parameters in CPSL can be passed by either value or reference. To be passed by +reference, a parameter must be a variable. No function or procedure can have +side effects, except for output or through global variables and reference +parameters. \subsection{Return} The return statement passes control back to a function or procedure caller. If it is a function the expression returned becomes the expression of the function call in the callers scope. \section{User Defined Types} From 8f9b6f968fa046d3fc28bcdb11543a244b64b659 Mon Sep 17 00:00:00 2001 From: Trevor Hullinger Date: Fri, 22 Apr 2016 07:27:36 -0600 Subject: [PATCH 2/2] Create definition for function overloading --- CPSL.tex | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CPSL.tex b/CPSL.tex index 0954a67..4d677a8 100644 --- a/CPSL.tex +++ b/CPSL.tex @@ -387,6 +387,18 @@ \subsection{Parameters} parameters. \subsection{Return} The return statement passes control back to a function or procedure caller. If it is a function the expression returned becomes the expression of the function call in the callers scope. +\subsection{Function Overloading} +Functions or procedures with different bodies may have the same name. For this +to be valid, each function/procedure must have a different type signature. A type +signature is defined by the order of parameters and their respective types. Note +that, + +\begin{itemize} +\item The parameter names do not affect a function's type signature. +\item \textbf{var}/\textbf{ref} does not change a function's type signature. +\item The return type also does not affect a function's type signature. +\end{itemize} + \section{User Defined Types} \subsection{Arrays} Arrays are a contiguously allocated, homogeneously typed set of variables.