Skip to content

Commit

Permalink
Closes #2283
Browse files Browse the repository at this point in the history
Moved text about illegal modification of outer, and added example (well, one line).
  • Loading branch information
HansOlsson committed May 11, 2019
1 parent 3890304 commit f19188f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions chapters/scoping.tex
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ \section{Instance Hierarchy Name Lookup of Inner Declarations}\doublelabel{insta
with the same name but using the prefix \lstinline!inner! which is nearest in the
enclosing instance hierarchy of the \lstinline!outer! element declaration.

Outer component declarations may not have modifications {[}\emph{including declaration equations}{]}.
Outer class declarations should be defined using short-class
definitions without modifications. However, see also \autoref{simultaneous-inner-outer-declarations}.

An \lstinline!outer! element reference in a simulation model requires that one
corresponding \lstinline!inner! element declaration exist or can be created in a
unique way:
Expand Down Expand Up @@ -211,8 +215,9 @@ \section{Instance Hierarchy Name Lookup of Inner Declarations}\doublelabel{insta
...
end A;
class B
inner Real T0;
A a1, a2; // B.T0, B.a1.T0 and B.a2.T0 is the same variable
inner Real T0=1;
A a1, a2; // B.T0, B.a1.T0 and B.a2.T0 will have the same value
A a3(T0=4); // Illegal as T0 is an outer variable.
...
end B;
\end{lstlisting}
Expand Down Expand Up @@ -318,11 +323,8 @@ \section{Simultaneous Inner/Outer Declarations}\doublelabel{simultaneous-inner-o
references the corresponding element in an enclosing scope with the
prefix} \lstinline!inner!\emph{.}{]}

Outer component declarations may only have modifications
{[}\emph{including declaration equations}{]} if they also have the \lstinline!inner!
prefix. Outer class declarations should be defined using short-class
definitions which only may have modifications if they also have the
\lstinline!inner! prefix. For both cases those modifications are only applied to the
Modifications of elements declared with both the prefixes \lstinline!inner! and \lstinline!outer!
may have modfications, those modifications are only applied to the
\lstinline!inner! declaration.

{[}\emph{Example}:
Expand Down

0 comments on commit f19188f

Please sign in to comment.