From 4ab72ad19aca52497b163eeac319d0671c1770e0 Mon Sep 17 00:00:00 2001 From: Hans Olsson Date: Mon, 28 Dec 2020 10:49:47 +0100 Subject: [PATCH] New impure (#2778) * Decisions in poll. A and B1. Closes #2756 * Add to subtyping as well. * Apply suggestions from code review Co-authored-by: Henrik Tidefelt --- chapters/functions.tex | 8 ++++---- chapters/interface.tex | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/chapters/functions.tex b/chapters/functions.tex index 8e4faab2d..45a3284b1 100644 --- a/chapters/functions.tex +++ b/chapters/functions.tex @@ -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. @@ -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 diff --git a/chapters/interface.tex b/chapters/interface.tex index 0ffe2744a..9da3d90aa 100644 --- a/chapters/interface.tex +++ b/chapters/interface.tex @@ -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}