Skip to content

Commit

Permalink
Cleanup related to 'redeclare'
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Oct 13, 2020
1 parent df10db6 commit 0cfa23d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
27 changes: 5 additions & 22 deletions chapters/inheritance.tex
Original file line number Diff line number Diff line change
Expand Up @@ -574,19 +574,9 @@ \subsection{Final Element Modification Prevention}\label{final-element-modificat

\section{Redeclaration}\label{redeclaration}

A redeclare construct in a modifier replaces the declaration of a local
class or component with another declaration. A redeclare construct as an
element replaces the declaration of a local class or component with
another declaration. Both redeclare constructs work in the same way. The
redeclare construct as an element requires that the element is
inherited, and cannot be combined with a modifier of the same element in
the extends-clause. For modifiers the redeclare of classes uses a
special short-class-definition construct; that is a subset of normal
class definitions and semantically behave as the corresponding
class-definition.

A modifier with the keyword \lstinline!replaceable! is automatically seen as being a
redeclare.
A \lstinline!redeclare! construct in a modifier replaces the declaration of a local class or component with another declaration. A \lstinline!redeclare! construct as an element replaces the declaration of a local class or component with another declaration. Both \lstinline!redeclare! constructs work in the same way. The \lstinline!redeclare! construct as an element requires that the element is inherited, and cannot be combined with a modifier of the same element in the extends-clause. For modifiers the redeclare of classes uses a special short-class-definition construct; that is a subset of normal class definitions and semantically behave as the corresponding class-definition.

A modifier with the keyword \lstinline!replaceable! is automatically seen as being a \lstinline!redeclare!.

In redeclarations some parts of the original declaration is
automatically inherited by the new declaration. This is intended to make
Expand Down Expand Up @@ -664,14 +654,7 @@ \section{Redeclaration}\label{redeclaration}

\subsection{The class extends Redeclaration Mechanism}\label{the-class-extends-redeclaration-mechanism}

A class declaration of the type \lstinline!redeclare class extends B($\ldots$)! ,
where \lstinline!class! as usual can be replaced by any other specialized class,
replaces the inherited class \lstinline!B! with another declaration that extends the
inherited class where the optional class-modification is applied to the
inherited class. Inherited \lstinline!B! here means that the class
containing \lstinline!redeclare class extends B($\ldots$)! should also inherit
another declaration of \lstinline!B! from one of its extends-clauses. The new
declaration should explicitly include redeclare.
A class declaration of the type \lstinline!redeclare class extends B($\ldots$)!, where \lstinline!class! as usual can be replaced by any other specialized class, replaces the inherited class \lstinline!B! with another declaration that extends the inherited class where the optional class-modification is applied to the inherited class. Inherited \lstinline!B! here means that the class containing \lstinline!redeclare class extends B($\ldots$)! should also inherit another declaration of \lstinline!B! from one of its extends-clauses. The new declaration should explicitly include \lstinline!redeclare!.

\begin{nonnormative}
Since the rule about applying the optional class-modification implies that all declarations are inherited with modifications applied, there is no need
Expand Down Expand Up @@ -993,7 +976,7 @@ \subsection{Restrictions on Redeclarations}\label{restrictions-on-redeclarations
\item
Array dimensions may be redeclared; provided the sub-typing rules in \cref{interface-compatibility-or-subtyping} are satisfied.
\begin{nonnormative}
This is one example of redeclare of non-replaceable elements.
This is one example of redeclaration of non-replaceable elements.
\end{nonnormative}
\end{itemize}

Expand Down
4 changes: 2 additions & 2 deletions chapters/revisions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,8 @@ \subsection{Main changes in Modelica 3.3 Revision 1}\label{main-changes-in-model
Clarified modifiers on constraining type, \cref{constraining-type}. Ticket
\href{https://github.com/modelica/ModelicaSpecification/issues/1033}{\#1033}.
\item
Clarified when redeclare can be used with the same type and rules for
redeclaring array types, \cref{restrictions-on-redeclarations}. Tickets
Clarified when \lstinline!redeclare! can be used with the same type and rules for redeclaring array types, \cref{restrictions-on-redeclarations}.
Tickets
\href{https://github.com/modelica/ModelicaSpecification/issues/1252}{\#1252},
\href{https://github.com/modelica/ModelicaSpecification/issues/1281}{\#1281}.
\item
Expand Down

0 comments on commit 0cfa23d

Please sign in to comment.