pat-rogers / Ada-202x-WG9-Informal-Review

This is the place for WG 9 members to submit informal comments on the 202x source document. (This is not the formal ballot that WG 9 will hold later in the process.)
0 stars 0 forks source link

8.5 (5) renaming with anonymous type #151

Open nholsti opened 3 years ago

nholsti commented 3 years ago

This note says that an object of an anonymous access type cannot be renamed. However, it seems to me that the second alternative in RM 8.5.1 (1/5), the "access_definition" case, does allow such a renaming. Similarly, RM 8.5 (5) says that a single task or protected object cannot be renamed since the corresponding type is anonymous, but as we can now omit the subtype_mark from the object_renaming_declaration, it seems that such entities can be renamed. Either I am wrong, or the statements in RM 8.5 (5) are wrong.

sttaft commented 3 years ago

Another good catch! I would suggest we change the note to say:

10 A task or protected object that is declared by an explicit object_declaration can be renamed as an object. However, a single task or protected object [cannot]{can} be renamed {only using the form of renaming that omits specifying the subtype} [since the corresponding type is anonymous (meaning it has no nameable subtypes). For similar reasons, an object of an anonymous array or access type cannot be renamed].

This is a bit informal (i.e. "specifying the subtype" is not a defined technical notion) but that is generally fine for a "Note".

ARG-Editor commented 3 years ago

I wonder if this note retains enough value to bother with it at all. The original purpose was to say that not all objects can be renamed, but that is False with Ada 202x, and indeed one now can rename most values as well. Saying that something can only be renamed with the most simple (and likely common) form of renaming is hardly interesting. We don't need notes to tell people random facts about the language.

I'll write up deleting the note in AI12-0427-1 (the fixup AI), and we can decide if that is acceptable or not in the ARG.