Eric Botcazou recently ventured into the heart of darkness (RM 3.10.2) to implement the rules relating to "tied" accessibility levels. He provided the following information about what he learned along the way, including some suggestions for improving the RM and AARM wording.
-Tuck
------- from Eric Botcazou ------
I have been trying over the last few days to understand the last example of AI12-0345 (the AI introducing the concept of accessibility levels being tied to each other). IMO the example is nontrivial to grasp, let alone to implement correctly, but I think that I get it now. However, a major source of difficulty is IMO to understand what this new relation defined on accessibility levels is about, since the AARM is quite terse about it. Therefore, assuming that it will be kept for the future, I'd suggest making the life of the next reader easier by adding a "Ramification" note right after 3.10.2(5) to elaborate a bit on it (and also possibly adding a small clarification to 5 itself). FWIW here's what I have written in my notes:
3.10.2(5): Each master, and each entity and view created by it, has an
accessibility level; when two levels are defined to be the same{ in a
particular construct by one of the following rules}, the accessibility
levels of the two associated entities are said to be tied to each other.
Accessibility levels are defined as follows:
{5.a Ramification: The relation thus defined on accessibility levels is an
explicitly symmetric and transitive form of the "defined to be the same"
relation. It is defined statically for the constituents of a particular
construct in the program and holds only in the context of this construct.}
but a better wording can probably be devised.
I'd also suggest making a small addition to the "21.b Ramification" note:
21.b Ramification:{ Note the "considered" instead of "defined" to be the same.}
This rule only applies when the level of an explicitly aliased parameter of a
function is compared to that of the return object of the function. [...]
Eric Botcazou recently ventured into the heart of darkness (RM 3.10.2) to implement the rules relating to "tied" accessibility levels. He provided the following information about what he learned along the way, including some suggestions for improving the RM and AARM wording.
-Tuck
------- from Eric Botcazou ------
I have been trying over the last few days to understand the last example of AI12-0345 (the AI introducing the concept of accessibility levels being tied to each other). IMO the example is nontrivial to grasp, let alone to implement correctly, but I think that I get it now. However, a major source of difficulty is IMO to understand what this new relation defined on accessibility levels is about, since the AARM is quite terse about it. Therefore, assuming that it will be kept for the future, I'd suggest making the life of the next reader easier by adding a "Ramification" note right after 3.10.2(5) to elaborate a bit on it (and also possibly adding a small clarification to 5 itself). FWIW here's what I have written in my notes:
I'd also suggest making a small addition to the "21.b Ramification" note: