What do the expressions in choice mean?
Consider these classes:
package C
constant Real p = 1.0;
model B
parameter Real ch annotation(choices(choice = p));
end B;
model TestModel
constant Real p = 2.0;
B b;
end TestModel;
end C;
Assume a user now opens C.TestModel, and applies the choice for b.ch using the tool of their choice.
What is the expected result? A:
model TestModel
constant Real p = 2.0;
B b(ch = p);
end TestModel;
Or B:
model TestModel
constant Real p = 2.0;
B b(ch = C.p);
end TestModel;
?
I find the specification unclear on this point.
Wouldn't the case that "literal" repleacement is meant imply that one needs to apply global name lookup by giving full names starting with . when redeclaration choices are given as to be on the safe side for the case that an instantiation is taking place in an encapsulated class?
The latter must be the desired solution, since it seems clear that the result should be the same regardless of where it is applied.
Dymola 2023 and 3D Experience R2022x (and earlier versions) handles this in some cases (the ones that have been most important I hope) - but not for all. Obviously the one constructing the model can avoid the ambiguity:
model B
parameter Real ch annotation(choices(choice = .C.p));
end B;
Proposal: The choices should use lookup from where they occur to find classes and constants. It is possible to simplify that by start the names with a dot, see Section 5.3.3.
Maybe it's worth illustrating the proposal with a situation where it is challenging (or even impossible) to express the modification that would correspond to a choice due to scoping rules at the place of the modification?
Language group: Could mention inaccessible classes (due to protected), seen as bad modeling practice. Can illustrate working case with example as well.