From 358e7b53e316c2691f7ed5d8f440bd403112998c Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 27 Jun 2024 16:15:10 +0200 Subject: [PATCH 01/16] LineBased --- chapters/inheritance.tex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 75180814d..0aaf40a21 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -418,7 +418,9 @@ \subsection{Merging of Modifications}\label{merging-of-modifications} \subsection{Single Modification}\label{single-modification} -Two arguments of a modification shall not modify the same element, attribute, or description-string. When using qualified names the different qualified names starting with the same identifier are merged into one modifier. If a modifier with a qualified name has the \lstinline!each! or \lstinline!final! prefix, that prefix is only seen as applied to the final part of the name. +Two arguments of a modification shall not modify the same element, attribute, or description-string. +When using qualified names the different qualified names starting with the same identifier are merged into one modifier. +If a modifier with a qualified name has the \lstinline!each! or \lstinline!final! prefix, that prefix is only seen as applied to the final part of the name. \begin{example} \begin{lstlisting}[language=modelica] From 42f26186d3e791293f8c893c41eaf5a6b471838a Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 27 Jun 2024 16:15:59 +0200 Subject: [PATCH 02/16] RestrictItToPossible --- chapters/inheritance.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 0aaf40a21..08aea75c2 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -419,7 +419,7 @@ \subsection{Merging of Modifications}\label{merging-of-modifications} \subsection{Single Modification}\label{single-modification} Two arguments of a modification shall not modify the same element, attribute, or description-string. -When using qualified names the different qualified names starting with the same identifier are merged into one modifier. +When using qualified names the different qualified names starting with the same identifier are merged into one modifier, if possible and unambigous. If a modifier with a qualified name has the \lstinline!each! or \lstinline!final! prefix, that prefix is only seen as applied to the final part of the name. \begin{example} From cb23e50b6860ec830afd91c848920d624bff3cc9 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 27 Jun 2024 16:20:08 +0200 Subject: [PATCH 03/16] AddFinalExample --- chapters/inheritance.tex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 08aea75c2..ce83ce613 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -436,6 +436,11 @@ \subsection{Single Modification}\label{single-modification} // Ok, different attributes designated (unit, displayUnit and value) // identical to: C4 b(x(final unit = "V", displayUnit = "mV") = 5.0)); + + C4 c(final x, final x.unit = "V", x.displayUnit = "mV"); + // Ok, different attributes and "final x" in itself is ok + // identical to (the final on unit is redundant). + C4 d(final x(final unit = "V", displayUnit = "mV")); end C3; \end{lstlisting} From 136013d93abc48a4cab2240993724224fabcd5e7 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 27 Jun 2024 16:25:44 +0200 Subject: [PATCH 04/16] AddRedeclareExample --- chapters/inheritance.tex | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index ce83ce613..653296938 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -459,6 +459,17 @@ \subsection{Single Modification}\label{single-modification} m1(r = 1.6, r "x") m1(r = R(), r(y(min = 2))) \end{lstlisting} + +Modifiers can be merged for non-replaceable redeclarations. +\begin{lstlisting}[language=modelica] +model Test + model A + replaceable Real x = 1; + end A; + + A a(redeclare Real x, x.start = 2); + // Identical to A a(redeclare Real x(start=2)); +\end{lstlisting} \end{example} \subsection{Modifiers for Array Elements}\label{modifiers-for-array-elements} From c6e6987a25f5c95da873897b90612126949dd3d9 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 27 Jun 2024 16:30:35 +0200 Subject: [PATCH 05/16] AddReplaceableExample --- chapters/inheritance.tex | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 653296938..31382331b 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -470,6 +470,27 @@ \subsection{Single Modification}\label{single-modification} A a(redeclare Real x, x.start = 2); // Identical to A a(redeclare Real x(start=2)); \end{lstlisting} + +For replaceable redeclarations the result would be ambigous. +\begin{lstlisting}[language=modelica] +model Test + partial model Base + parameter Real p; + end Base; + + model Implementation + extends Base; + parameter Real q; + end Implementation; + + model A + replaceable Base b constrainedby Base(p=1); + end A; + + A a(redeclare replaceable Implementation b constrainedby Base, b.q=1); + // Is that modifier supposed to be moved into b() or into Base()? +end Test; +\end{lstlisting} \end{example} \subsection{Modifiers for Array Elements}\label{modifiers-for-array-elements} From d53d4898bd45b9f3ca9738c51c34c9decaafdb20 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 27 Jun 2024 16:30:50 +0200 Subject: [PATCH 06/16] AddEnd --- chapters/inheritance.tex | 1 + 1 file changed, 1 insertion(+) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 31382331b..a82892b7d 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -469,6 +469,7 @@ \subsection{Single Modification}\label{single-modification} A a(redeclare Real x, x.start = 2); // Identical to A a(redeclare Real x(start=2)); +end Test; \end{lstlisting} For replaceable redeclarations the result would be ambigous. From 45bf28b8c7a269c33254acac9555a56ee2e5c05b Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 27 Jun 2024 22:30:31 +0200 Subject: [PATCH 07/16] WS --- chapters/inheritance.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index a82892b7d..41aada4a0 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -436,7 +436,7 @@ \subsection{Single Modification}\label{single-modification} // Ok, different attributes designated (unit, displayUnit and value) // identical to: C4 b(x(final unit = "V", displayUnit = "mV") = 5.0)); - + C4 c(final x, final x.unit = "V", x.displayUnit = "mV"); // Ok, different attributes and "final x" in itself is ok // identical to (the final on unit is redundant). @@ -466,7 +466,7 @@ \subsection{Single Modification}\label{single-modification} model A replaceable Real x = 1; end A; - + A a(redeclare Real x, x.start = 2); // Identical to A a(redeclare Real x(start=2)); end Test; @@ -478,7 +478,7 @@ \subsection{Single Modification}\label{single-modification} partial model Base parameter Real p; end Base; - + model Implementation extends Base; parameter Real q; @@ -487,7 +487,7 @@ \subsection{Single Modification}\label{single-modification} model A replaceable Base b constrainedby Base(p=1); end A; - + A a(redeclare replaceable Implementation b constrainedby Base, b.q=1); // Is that modifier supposed to be moved into b() or into Base()? end Test; From 61369dda2e5c67ad5c2c013d2fca0e51a971eab3 Mon Sep 17 00:00:00 2001 From: HOS Date: Thu, 27 Jun 2024 22:31:00 +0200 Subject: [PATCH 08/16] WSLast --- chapters/inheritance.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 41aada4a0..0163466d3 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -483,7 +483,7 @@ \subsection{Single Modification}\label{single-modification} extends Base; parameter Real q; end Implementation; - + model A replaceable Base b constrainedby Base(p=1); end A; From 6df6022eee2870880cc835a3d028c733b0359ae0 Mon Sep 17 00:00:00 2001 From: HOS Date: Fri, 28 Jun 2024 16:27:37 +0200 Subject: [PATCH 09/16] Allow all cases, but describe that it isn't syntactic sugar in the odd case. --- chapters/inheritance.tex | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 0163466d3..60f0d95a6 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -419,7 +419,8 @@ \subsection{Merging of Modifications}\label{merging-of-modifications} \subsection{Single Modification}\label{single-modification} Two arguments of a modification shall not modify the same element, attribute, or description-string. -When using qualified names the different qualified names starting with the same identifier are merged into one modifier, if possible and unambigous. +When using qualified names the different qualified names starting with the same identifier are merged into one modifier. +This merged modifier is as an actual modifier, except in the case of replaceable redeclarations without a constraining type. If a modifier with a qualified name has the \lstinline!each! or \lstinline!final! prefix, that prefix is only seen as applied to the final part of the name. \begin{example} @@ -460,7 +461,7 @@ \subsection{Single Modification}\label{single-modification} m1(r = R(), r(y(min = 2))) \end{lstlisting} -Modifiers can be merged for non-replaceable redeclarations. +Modifiers can be merged for non-replaceable redeclarations, or replaceable redeclarations with a constraining type. \begin{lstlisting}[language=modelica] model Test model A @@ -469,10 +470,12 @@ \subsection{Single Modification}\label{single-modification} A a(redeclare Real x, x.start = 2); // Identical to A a(redeclare Real x(start=2)); + A a(redeclare replaceable Real x constrainedby Real, x.start = 2); + // Identical to A a(redeclare Real x constrainedby Real(start=2)); end Test; \end{lstlisting} -For replaceable redeclarations the result would be ambigous. +For replaceable redeclarations without a constraining type the merging is only conceptual. \begin{lstlisting}[language=modelica] model Test partial model Base @@ -488,8 +491,10 @@ \subsection{Single Modification}\label{single-modification} replaceable Base b constrainedby Base(p=1); end A; - A a(redeclare replaceable Implementation b constrainedby Base, b.q=1); - // Is that modifier supposed to be moved into b() or into Base()? + A a(redeclare replaceable Implementation b, b.q=1); + // This is treated the same as + // A a(redeclare replaceable Implementation b constrainedby Base(q=1)); + // This is no longer a syntactic rewrite as it relies on the constrainedby class end Test; \end{lstlisting} \end{example} From e07a37cdfca2eececaef9801ffa1562bd2664bbc Mon Sep 17 00:00:00 2001 From: HOS Date: Fri, 28 Jun 2024 16:36:35 +0200 Subject: [PATCH 10/16] Try to be clearer. --- chapters/inheritance.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 60f0d95a6..ec8814ef4 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -420,7 +420,7 @@ \subsection{Single Modification}\label{single-modification} Two arguments of a modification shall not modify the same element, attribute, or description-string. When using qualified names the different qualified names starting with the same identifier are merged into one modifier. -This merged modifier is as an actual modifier, except in the case of replaceable redeclarations without a constraining type. +This merged modifier can be described as a purely syntactic rewriting to an equivalent modifier, except in the case of replaceable redeclarations without a constraining type. If a modifier with a qualified name has the \lstinline!each! or \lstinline!final! prefix, that prefix is only seen as applied to the final part of the name. \begin{example} From 54eb45db588e6c09d1d326d1aec344b04e264c92 Mon Sep 17 00:00:00 2001 From: HOS Date: Fri, 28 Jun 2024 17:16:08 +0200 Subject: [PATCH 11/16] WS --- chapters/inheritance.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index ec8814ef4..0d881e336 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -492,7 +492,7 @@ \subsection{Single Modification}\label{single-modification} end A; A a(redeclare replaceable Implementation b, b.q=1); - // This is treated the same as + // This is treated the same as // A a(redeclare replaceable Implementation b constrainedby Base(q=1)); // This is no longer a syntactic rewrite as it relies on the constrainedby class end Test; From 78a4de01e59e75f8f50b3bfdae167d7d2d5c0942 Mon Sep 17 00:00:00 2001 From: Hans Olsson Date: Mon, 1 Jul 2024 09:17:23 +0200 Subject: [PATCH 12/16] Apply suggestions from code review Co-authored-by: Henrik Tidefelt --- chapters/inheritance.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 0d881e336..c34773b7e 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -439,8 +439,8 @@ \subsection{Single Modification}\label{single-modification} C4 b(x(final unit = "V", displayUnit = "mV") = 5.0)); C4 c(final x, final x.unit = "V", x.displayUnit = "mV"); - // Ok, different attributes and "final x" in itself is ok - // identical to (the final on unit is redundant). + // OK, different attributes and "final x" in itself is OK, + // identical to (the final on unit is redundant): C4 d(final x(final unit = "V", displayUnit = "mV")); end C3; \end{lstlisting} From c9dfbbe20b9711a44f9b4ace46ab06fbf3ecaad8 Mon Sep 17 00:00:00 2001 From: Hans Olsson Date: Thu, 5 Sep 2024 16:26:37 +0200 Subject: [PATCH 13/16] Update chapters/inheritance.tex Co-authored-by: Elena Shmoylova --- chapters/inheritance.tex | 1 + 1 file changed, 1 insertion(+) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index c34773b7e..29a9842f1 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -421,6 +421,7 @@ \subsection{Single Modification}\label{single-modification} Two arguments of a modification shall not modify the same element, attribute, or description-string. When using qualified names the different qualified names starting with the same identifier are merged into one modifier. This merged modifier can be described as a purely syntactic rewriting to an equivalent modifier, except in the case of replaceable redeclarations without a constraining type. +The latter is described in the example below. If a modifier with a qualified name has the \lstinline!each! or \lstinline!final! prefix, that prefix is only seen as applied to the final part of the name. \begin{example} From 97df27604537d3c5db805fa5b15e50df3a5ff1be Mon Sep 17 00:00:00 2001 From: HOS Date: Fri, 20 Sep 2024 13:38:54 +0200 Subject: [PATCH 14/16] Avoid "conceptual" --- chapters/inheritance.tex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 29a9842f1..2651a9246 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -476,7 +476,7 @@ \subsection{Single Modification}\label{single-modification} end Test; \end{lstlisting} -For replaceable redeclarations without a constraining type the merging is only conceptual. +For replaceable redeclarations without a constraining type the merging is not a local syntactic rewrite as it requires the constraining type. \begin{lstlisting}[language=modelica] model Test partial model Base @@ -495,7 +495,8 @@ \subsection{Single Modification}\label{single-modification} A a(redeclare replaceable Implementation b, b.q=1); // This is treated the same as // A a(redeclare replaceable Implementation b constrainedby Base(q=1)); - // This is no longer a syntactic rewrite as it relies on the constrainedby class + // This is no longer a local syntactic rewrite as the constrainedby + // references the constraining class end Test; \end{lstlisting} \end{example} From dbdba02f55523252186db02234d6c4b909b2f921 Mon Sep 17 00:00:00 2001 From: HOS Date: Fri, 20 Sep 2024 13:42:39 +0200 Subject: [PATCH 15/16] ForwardReference --- chapters/inheritance.tex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 2651a9246..1d1c26758 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -420,7 +420,7 @@ \subsection{Single Modification}\label{single-modification} Two arguments of a modification shall not modify the same element, attribute, or description-string. When using qualified names the different qualified names starting with the same identifier are merged into one modifier. -This merged modifier can be described as a purely syntactic rewriting to an equivalent modifier, except in the case of replaceable redeclarations without a constraining type. +This merged modifier can be described as a purely syntactic rewriting to an equivalent modifier, except in the case of replaceable redeclarations without a constraining type, see \cref{redeclaration}. The latter is described in the example below. If a modifier with a qualified name has the \lstinline!each! or \lstinline!final! prefix, that prefix is only seen as applied to the final part of the name. @@ -462,7 +462,7 @@ \subsection{Single Modification}\label{single-modification} m1(r = R(), r(y(min = 2))) \end{lstlisting} -Modifiers can be merged for non-replaceable redeclarations, or replaceable redeclarations with a constraining type. +Modifiers can be merged for non-replaceable redeclarations, or replaceable redeclarations with a constraining type, see \cref{redeclaration}. \begin{lstlisting}[language=modelica] model Test model A @@ -476,7 +476,7 @@ \subsection{Single Modification}\label{single-modification} end Test; \end{lstlisting} -For replaceable redeclarations without a constraining type the merging is not a local syntactic rewrite as it requires the constraining type. +For replaceable redeclarations without a constraining type the merging is not a local syntactic rewrite as it requires the constraining type, see \cref{redeclaration}. \begin{lstlisting}[language=modelica] model Test partial model Base From 2abcdbb4c1dcd813f61213923e7ee7775d0bfd51 Mon Sep 17 00:00:00 2001 From: HOS Date: Fri, 20 Sep 2024 13:44:12 +0200 Subject: [PATCH 16/16] WS --- chapters/inheritance.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/inheritance.tex b/chapters/inheritance.tex index 1d1c26758..cd5d9087a 100644 --- a/chapters/inheritance.tex +++ b/chapters/inheritance.tex @@ -495,7 +495,7 @@ \subsection{Single Modification}\label{single-modification} A a(redeclare replaceable Implementation b, b.q=1); // This is treated the same as // A a(redeclare replaceable Implementation b constrainedby Base(q=1)); - // This is no longer a local syntactic rewrite as the constrainedby + // This is no longer a local syntactic rewrite as the constrainedby // references the constraining class end Test; \end{lstlisting}