Skip to content

Commit

Permalink
Clarify scoping for component names
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Jun 18, 2020
1 parent 59d768b commit 85b0b13
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions chapters/classes.tex
Expand Up @@ -54,8 +54,7 @@ \section{Access Control -- Public and Protected Elements}\doublelabel{access-con
\section{Double Declaration not Allowed}\doublelabel{double-declaration-not-allowed}

The name of a declared element shall not have the same name as any other
element in its partially flattened enclosing class. A component shall
not have the same name as its type specifier. However, the internal
element in its partially flattened enclosing class. However, the internal
flattening of a class can in some cases be interpreted as having two
elements with the same name; these cases are described in \autoref{simultaneous-inner-outer-declarations},
and \autoref{redeclaration}.
Expand Down
13 changes: 13 additions & 0 deletions chapters/scoping.tex
Expand Up @@ -135,6 +135,19 @@ \subsection{Composite Name Lookup}\doublelabel{composite-name-lookup}
\autoref{redeclaration} for further explanations regarding looking inside
partial packages.
\end{nonnormative}
\begin{example}
Components and classes are part of the same name-space and thus a component may
not have the same name as its class or the first part of the class-name as that
would prevent looking up the name of the class.
\begin{lstlisting}[language=modelica]
model A
M M; // Illegal, component 'M' prevents finding class 'M'
P.Q P; // Illegal, component 'P' prevents finding package 'P'
.R R; // Legal, see next section
S.Q Q; // Legal
end A;
\end{lstlisting}
\end{example}

\subsection{Global Name Lookup}\doublelabel{global-name-lookup}

Expand Down

0 comments on commit 85b0b13

Please sign in to comment.