Skip to content

Commit

Permalink
New impure (#2778)
Browse files Browse the repository at this point in the history
* Decisions in poll.
A and B1.
Closes #2756
* Add to subtyping as well.
* Apply suggestions from code review
Co-authored-by: Henrik Tidefelt <henrikt@wolfram.com>
  • Loading branch information
HansOlsson committed Dec 28, 2020
1 parent 4d86220 commit 4ab72ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions chapters/functions.tex
Expand Up @@ -245,6 +245,8 @@ \section{Pure Modelica Functions}\label{pure-modelica-functions}
\end{nonnormative}
\item
External functions must be explicitly declared with \lstinline!pure! or \lstinline!impure!.
\item
If a function is declared as \lstinline!impure! any function extending from it shall be declared as \lstinline!impure!.
\item
A deprecated semantics is that external functions (and functions defined in Modelica directly or indirectly calling them) without \lstinline!pure! or \lstinline!impure! keyword are assumed to be
impure, but without any restriction on calling them. Except for the function \lstinline!Modelica.Utilities.Streams.print!, diagnostics must be given if called in a simulation model.
Expand Down Expand Up @@ -317,10 +319,8 @@ \section{Pure Modelica Functions}\label{pure-modelica-functions}
allowed.
\end{nonnormative}

It is possible to mark a function formal parameter as \lstinline!impure!. Only if
the function formal parameter is marked \lstinline!impure!, it is allowed to pass an
\lstinline!impure! function to it. A function having a formal function parameter
marked \lstinline!impure! must be marked \lstinline!pure! or \lstinline!impure!.
By \cref{function-compatibility-or-function-subtyping-for-functions}, it follows that an impure function can only be passed as argument to a function formal parameter of impure type.
A function having a formal function parameter that is \lstinline!impure! must be marked \lstinline!pure! or \lstinline!impure!.

\begin{nonnormative}
Comment: The semantics are undefined if the function call of an
Expand Down
2 changes: 2 additions & 0 deletions chapters/interface.tex
Expand Up @@ -532,6 +532,8 @@ \section{Function-Compatibility or Function-Subtyping for Functions}\label{funct
\item
A public input component of \lstinline!A! not present in \lstinline!B! must have a binding
assignment.
\item
If \lstinline!A! is impure, then \lstinline!B! must also be impure, compare \cref{pure-modelica-functions}.
\end{itemize}
\end{definition}

Expand Down

0 comments on commit 4ab72ad

Please sign in to comment.