Version 1.1 of ai05s/ai05-0080-1.txt

Unformatted version of ai05s/ai05-0080-1.txt version 1.1
Other versions for file ai05s/ai05-0080-1.txt

!standard 3.1(7)          08-01-16 AI05-0080-1/01
!class binding interpretation 08-01-16
!status work item 08-01-16
!status received 07-12-07
!priority Low
!difficulty Hard
!qualifier Omission
!subject "view of" is not needed when it is clear from context
!summary
The words "view of" an entity are assumed when it is clear from context that only a "view" makes sense.
!question
We often have arguments about whether "object" or "type" means exactly that, or whether it really means "view of an object" or "view of a type". It's generally agreed that the Standard would make any sense if this is not applied, because there are many places where a view is what is being considered (otherwise privacy would be broken).
However, nowhere does the Standard ever explain this point. Readers of the Standard (like implementers) ask the ARG whenever they find a statement that seems to break privacy; it is unpleasant to tell them to trust us, everything is fine.
One way to fix this is to add wording somwhere toward the start of the standard to make this assumption explicit. Should this wording be added? (Yes.)
!recommendation
(See Summary.)
!wording
Add after 3.1(7):
When it is clear from context, the term *object* is used in place of *view of an object. Similarly, the term type" is used in place of "view of a type".
AARM Note:
Rules interpreted at compile-time generally refer to views of entities, rather than the entities themselves. This is necessary to preserve privacy; characteristics that are not visible should not be used in compile-time rules. Thus, Static Semantics and Legality Rules generally implicitly have "view of". Legality Rules that need to ignore the private part (for instance, those involving representation items) are the exception to this interpretation.
On the other hand, run-time rules can work either way, so "view of" should not be assumed in Dynamic Semantics rules.
!discussion
It would be best to insert "view of" everywhere in the Standard that needs it, but such an effort would be a massive amount of work, and surely would introduce as many bugs as it would fix. So we go with a blanket statement.
We have to be careful with the wording, because it is not quite all of the time (even at compile-time) that "view of" should be assumed. It is especially hard to "unassume" it when it is inappropriate. Thus the wording is intentionally vague.
Note that this wording implies that "view of" should not be assumed in dynamic rules; any that need "view of" and do not have it are wrong.
--!corrigendum 13.9(7)
!ACATS Test
This is surely not testable, especially given that the intent is that nothing changes.
!appendix

From: Randy Brukardt
Sent: Thursday, December 6, 2007  8:06 PM

[This was originally part of a thread that is filed in AC-00153. The initial thread
can be read there. - ED]

Tucker wrote:

> One important thing to recognize is that the
> phrase "view of" should be inserted in
> front of "object" and "type" almost everywhere
> you see them in the manual.  The compiler
> only knows what it learns from declarations,
> and declarations always define views of entities,
> but only sometimes define the entities themselves.

To expand on this a bit:

It is clear from the discussion (and rejection!) of AI05-0068-1/01 at
Fairfax that in Legality Rules, "object" and "type" always really mean "view
of object" and "view of type". Anything else would break privacy and cause
all manner of bad effects.

What I don't understand is why there is such resistance to saying that in
the Standard. AI-68 was trying to add "view of" into wording that clearly
depends on that, and the decision was that it is "obvious". But there are a
number of cases in the Standard (for instance, 10.1.1(9)) where we say "when
it clear from context, we also use the term *yadayada* to mean <something
that is not quite a yadayada>". It seems to me that if we're not willing to
change the wording to include "view of", then we need a statement somewhere
(3.1(7)?) like:

"When it is clear from context, the term *object* is used in place of *view
of an object*. Similarly, the term *type" is used in place of "view of a type"."

or maybe

"When it is clear from context, the Standard may simply refer to an entity
(such as an object, type, or subprogram) to rather than a view of the
entity."

With an AARM note of something like:

"Rules interpreted at compile-time always refer to views of entities, rather
than the entities themselves. This is necessary to preserve privacy;
characteristics that are not visible should not be used in compile-time
rules. Thus, Static Semantics and Legality Rules always implicitly have
"view of". On the other hand, run-time rules can work either way, so "view
of" should not be assumed in Dynamic Semantics rules."

Then when we just questions like Adam's, we can simply point the questioner
at the appropriate paragraph and have them go away.

Personally, I would rather use the precise wording everywhere (and we
usually do in new wording), but I realize it is probably too late to go back
and fix the entire RM for this problem. But what I don't like is telling
questioners over and over that "of course that means *view of*" when there
is no indication anywhere in the Standard (at least that I can find) that
that is the case. This is way too important to understanding the Standard to
not say it normatively somewhere.

****************************************************************

From: Adam Beneschan
Sent: Friday, December 7, 2007  11:45 AM

> It is clear from the discussion (and rejection!) of AI05-0068-1/01 at
> Fairfax that in Legality Rules, "object" and "type" always really mean "view
> of object" and "view of type". Anything else would break privacy and cause
> all manner of bad effects.

I'd like to make a couple points in this regard:

(1) The original sentence that caused me confusion (3.10.2(12.4)) was
    in a "Static Semantics" section, not a "Legality Rules".  Perhaps
    what you're saying applies to both.

(2) With regards to this suggestion:

    "When it is clear from context, the term *object* is used in place
    of *view of an object*. Similarly, the term *type" is used in
    place of "view of a type"."

    I think I could live with something like this anywhere in the RM
    *except* 3.10.2 (maybe there's a few other places).  One reason is
    simply that 3.10.2 is so difficult (for me) to understand that
    when I read it, I try read it very carefully to make sure I'm
    getting it right; and I tend to go more into my "take everything
    literally" mode, or perhaps you could call it "fine-toothed comb"
    mode, to make sure I understand what's going on.  Simply because
    of that, from my point of view this is probably the wrong section
    of the RM to rely on things being "clear from context".  Another
    particular issue with 3.10.2 is that 3.10.2(5), which introduces
    the section I had the problem with, says:

    "Each master, and each entity and view created by it, has an
    accessibility level:"

    Since an object is an entity, this would seem to say that
    *objects* per se have their own accessibility levels, and the view
    of an object would have its own accessibility level---and the two
    don't necessarily match.  This introductory sentence suggests, by
    itself, that in this section, it should never be assumed that
    "object" means "view of an object".

So even if it's decided that it's too much work to make all the
wording precise everywhere in the RM, I'd like to suggest that 3.10.2,
or at least paragraphs 5-22, do need to be precise, and not rely on
anything being "clear from context".

****************************************************************

From: Randy Brukardt
Sent: Friday, December 7, 2007  11:01 PM

> I'd like to make a couple points in this regard:
>
> (1) The original sentence that caused me confusion (3.10.2(12.4)) was
>     in a "Static Semantics" section, not a "Legality Rules".  Perhaps
>     what you're saying applies to both.

The AARM note that I proposed said exactly that.

> (2) With regards to this suggestion:
>
>     "When it is clear from context, the term *object* is used in place
>     of *view of an object*. Similarly, the term *type" is used in
>     place of "view of a type"."
>
>     I think I could live with something like this anywhere in the RM
>     *except* 3.10.2 (maybe there's a few other places).
...
> So even if it's decided that it's too much work to make all the
> wording precise everywhere in the RM, I'd like to suggest that 3.10.2,
> or at least paragraphs 5-22, do need to be precise, and not rely on
> anything being "clear from context".

I personally think that it is *hardly ever* clear from context, and that any
wording that confuses anyone reasonably knowledgeable with the Standard
should be made explicit. (That certainly was true of 3.9.3(4/2), since
neither Pascal nor I realized it was "obvious" that that rule applied to
views of types rather than just types. You get nonsense results otherwise,
but it takes a while to figure that out, and surely that shouldn't be a
criteria for determining wording. But the full ARG felt otherwise.)

But I've tilted at that particular windmill a number of times, and I don't
think it makes sense to waste any more of my time (or the ARA's money)
continuing to do so. Unless you can convince other ARG members (who come to
meetings!!) of the need for a wording change, there is no point in
progressing your request.

What bothers me is that the Standard has no indication that you might need
to stick "view of" in front of various entities in rules. I don't know how
you are supposed to read that into the current wording of the Standard,
whether or not it is "clear from context" (which is a point that always can
be argued). Depending on the "font of Ada intent" (that is Tucker) is not a
good plan for a Standard!!

Unless this is corrected, most wording that doesn't have "view of" is wrong.
And thus needs to be fixed.

****************************************************************

From: Pascal Leroy
Sent: Monday, December 10, 2007  3:19 AM

> "When it is clear from context, the term *object* is used in place of *view
> of an object*. Similarly, the term *type" is used in place of "view of a type"."

I support this proposal.  It was IMO a mistake in the first place to omit
"view" in random places (but not everywhere), because it caused a lot of
confusion over the years.  But we (you) are not going to fix this now, so
the best we can do is to have a blanket statement like the above. 
 
> "Rules interpreted at compile-time always refer to views of entities, rather 
> than the entities themselves. This is necessary to preserve privacy;
> characteristics that are not visible should not be used in compile-time
> rules. Thus, Static Semantics and Legality Rules always implicitly have 
> "view of". On the other hand, run-time rules can work either way, so "view
> of" should not be assumed in Dynamic Semantics rules."

Things are not that simple.  There are a few Static Semantics or Legality Rules
that actually need to peek at the private part.  This is notably the case in
chapter 13: for instance, the legality of a size clause for an object depends
on the size of the *type* (there is no such thing as the size of a view).
So you cannot say "always" above, you have to say "generally" and mention that
there are exceptions but that they are (hopefully) clear from context. 
 
> But what I don't like is telling
> questioners over and over that "of course that means *view of*" when there 
> is no indication anywhere in the Standard (at least that I can find) that
> that is the case.

I couldn't agree more.  Blame Tuck ;-)

****************************************************************

From: Tucker Taft
Sent: Monday, December 10, 2007  1:05 PM

Blame Jean ;-)

****************************************************************


Questions? Ask the ACAA Technical Agent