Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions CPSL.tex
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,24 @@ \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.
\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.
Expand Down