Skip to content

Commit

Permalink
Clarify that there is no restriction for the text.
Browse files Browse the repository at this point in the history
Having a requirement that prevents a tool from just showing the text may have a bad performance impact.
  • Loading branch information
HansOlsson committed Nov 9, 2023
1 parent 4d700cf commit 842471f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions chapters/annotations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2087,26 +2087,32 @@ \subsection{Protection of Classes}\label{protection-of-classes}
annotation(Line(origin = {49.5, 30}, points = {{-8.5, 0}, {8.5, -0}}));
annotation(Protection(access = Access.diagram));
end M;

model M2
MySecret mySecret;
// The class MySecret is a simpler Modelica.Blocks.Sources.ContinuousClock
MySecret mySecret annotation(Placement(
transformation(origin = {30, 30}, extent = {{-10, -10}, {10, 10}})));
annotation(Protection(access = Access.packageDuplicate));
end M2;
end P;
\end{lstlisting}
In order to not reveal the existence of the class \lstinline!P.MySecret!, a tool may choose to show the diagram of \lstinline!P.M! with both \lstinline!mySecret! and all connections to it removed.
In order to not reveal the existence of the class \lstinline!P.MySecret! in \lstinline!P.M!, a tool may choose to show the diagram of \lstinline!P.M! with both \lstinline!mySecret! and all connections to it removed.
(The tool could also choose to not show the diagram of \lstinline!P.M! at all, or even reject to load the package \lstinline!P! altogether.)
As long as the invalid use of \lstinline!P.MySecret! occurs within the same top level package as where the class is defined (here, \lstinline!P!), a tool is allowed to silently ignore the use for purposes of model translation.
When simulating \lstinline!P.M!, the tool must not store \lstinline!mySecret.y!.
In order to support development of valid protected packages, it is of course OK and expected that a tool will report the invalid use of \lstinline!P.MySecret! in \lstinline!P.M! (revealing its existence in a diagnostic) during development of the package.

It is not specified whether a tool hides the entire text of \lstininline!P.M2!, hides just the declaration, or shows the entire text of the \lstininline!P.M2!.
In order to support development of valid protected packages, it is of course OK and expected that a tool will report the invalid use of \lstinline!P.MySecret! in \lstinline!P.M! and \lstinline!P.M2! (revealing its existence in a diagnostic) during development of the package.
\end{example}

\begin{example}
With the same package \lstinline!P! as in the previous example, consider invalid outside of \lstinline!P!:
\begin{lstlisting}[language=modelica]
model My
// There exist a class P.MySecret
P.MySecret a
annotation(Placement(
transformation(origin = {30, 30}, extent = {{-10, -10}, {10, 10}})));;
transformation(origin = {30, 30}, extent = {{-10, -10}, {10, 10}})));
end My;
\end{lstlisting}
Regardless of the protection of \lstinline!My!, a tool must act as if \lstinline!P.MySecret! did not exist.
Expand Down

0 comments on commit 842471f

Please sign in to comment.