-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarification on modifying encapsulated classes #2743
Labels
clarification
Specification of feature is unclear, but not incorrect
Milestone
Comments
eshmoylova
added
the
clarification
Specification of feature is unclear, but not incorrect
label
Nov 27, 2020
|
For item 4 the proposal would be: An exception is that if the short class definition is declared as encapsulated, then the class-modifiers cannot be looked up in the enclosing scope. |
Agreement. (And will change 2 in Dymola.) |
HansOlsson
added a commit
to HansOlsson/ModelicaSpecification
that referenced
this issue
Dec 15, 2020
HansOlsson
added a commit
that referenced
this issue
Dec 16, 2020
* Add exception for encapsulated short class lookup, and example demonstrating it. Closes #2743
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe the encapsulated classes are not explained sufficiently well in the Specification (3.4 or the current master). In particularly, it is not clearly stated what happens to encapsulated classes when they are modified, extended, or redeclared. As a result different tools treat them differently, which is a reason for concern.
I tried to come up with all possible cases which I believe may or may not influence encapsulation status of the result in the following examples.
The encapsulated model
P.Source1
contains a reference that can be found if searching in scope and should not be found if looking up in the global scope as you should for the encapsulated class. The other models are different ways to extend it and instantiate it. The question is which of them should produce an error. I tried three different tools and got three different results. The question came up when one of the user models used one of those constructs and the different results they get.P.Source1
should give an error.P2.Source2
give an error? It would appear thatSource2
should not give an error because it is not declared as encapsulated. The content ofP.Source1
should be brought intoSource2
. But should that content remember the scope it came from? It was encapsulated after all.P2.Source3
?P2.Source4
. As @HansOlsson brought up in this comment.P3.Source1
andM.s
?This issue originally came up in #2623 but it looks to be a bigger issue that redeclaration alone.
The text was updated successfully, but these errors were encountered: