!standard 6.3.1(24) 05-03-15 AI95-00397/02 !standard 9.1(9.1) !standard 9.4(11) !standard 9.5.2(2) !standard 9.5.2(10) !standard 9.5.2(13) !class amendment 05-01-25 !status Amendment 200Y 05-03-14 !status ARG Approved 10-0-0 05-02-13 !status work item 05-01-25 !status received 05-01-25 !priority High !difficulty Easy !subject Conformance and overriding for entries and protected operations !summary (See proposal.) !problem 6.3.1(24/1) talks about subtype conformance of an entry and a subprogram, but an entry and a subprogram never have the same convention. Furthermore, it would seem that we would want the overriding indicators to be usable for entries and protected subprograms, even though they don't override anything (they implement the parent subprogram). !proposal Defined the term *prefixed view profile* to reduce the verbiage about "omitting the first parameter" and also to resolve the problem of convention matching. Replicated the wording from 8.3 about overriding indicators, with the simplification that entries and protected operations are not primitive operations. !wording Replace the paragraph inserted by AI95-00345 after 6.3.1(24) by: The *prefixed view profile* of a subprogram is the profile obtained by omitting the first parameter of that subprogram. There is no prefixed view profile for a parameterless subprogram. For the purposes of defining subtype and mode conformance, the convention of a prefixed view profile is considered to match that of either an entry or a protected operation. AARM Note: The weird rule about conventions is pretty much required for synchronized interfaces to make any sense. There will be wrappers all over the place anyway. Of course, this doesn't imply that entries have the same convention as protected operations. Replace the third paragraph inserted by AI95-00345 after 9.1(9.1/1) by: For a task_type_declaration, if the first parameter of a primitive inherited subprogram is of the task type or an access parameter designating the task type, and there is an entry_declaration for a single entry with the same identifier within the task_type_declaration, whose profile is type conformant with the prefixed view profile of inherited subprogram, the inherited subprogram is said to be *implemented* by the conforming task entry. Replace the eighth paragraph inserted by AI95-00345 after 9.1(9.1/1) (the second bullet) by: o the inherited subprogram is implemented by a single entry of the task type; in which case its prefixed view profile shall be subtype conformant with that of the task entry. Replace the paragraph inserted by AI95-00345 after 9.4(11) by: For a protected_type_declaration, if the first parameter of a primitive inherited subprogram is of the protected type or an access parameter designating the protected type, and there is a protected_operation_declaration for a protected subprogram or single entry with the same identifier within the protected_type_declaration, whose profile is type conformant with the prefixed view profile of the inherited subprogram, the inherited subprogram is said to be *implemented* by the conforming protected subprogram or entry. Replace the sixth paragraph inserted by AI95-00345 after 9.4(11) (the second bullet) by: o the inherited subprogram is implemented by a protected subprogram or single entry of the protected type, in which case its prefixed view profile shall be subtype conformant with that of the protected subprogram or entry. Add after the last paragraph inserted by AI95-00345 after 9.4(11): If a protected subprogram declaration has an overriding_indicator, then: o if the overriding_indicator is *overriding*, then the subprogram shall implement an inherited subprogram, at the point of the declaration; o if the overriding_indicator is *not overriding*, then the subprogram shall not implement any inherited subprogram (at any point). Change 9.5.2(2) to read: entry_declaration ::= [overriding_indicator] entry defining_identifier [(discrete_subtype_definition)] parameter_profile; Add after 9.5.2(10): An overriding_indicator is not allowed in an entry_declaration that includes a discrete_subtype_definition. Add after 9.5.2(13): If an entry_declaration has an overriding_indicator, then: o if the overriding_indicator is *overriding*, then the entry shall implement an inherited subprogram, at the point of the declaration; o if the overriding_indicator is *not overriding*, then the operation shall not implement any inherited subprogram (at any point). AARM Note: An entry family never implements anything, so only *not overriding* can be given on the declaration of a family. !discussion The wording for overriding indicators applied to entries and protected subprograms was put this the definition of entries and protected subprograms, respectively, because it depends on the technical term "implemented" which is defined there. Putting it in 8.3 would have created a giant forward reference. !example Here is a simple readers and writers interface: type RW is limited interface; procedure Write (Obj : out RW; X : Integer) is abstract; procedure Read (Obj : RW; X : out Integer) is abstract; This interface may be implemented by a protected object. In order to allow several readers to proceed in parallel, the Read subprogram is implemented by a non-protected procedure that calls a protected function. The Write subprogram is directly implemented by a protected procedure: protected type Prot_RW is new RW with overriding procedure Write (X : Integer); not overriding function Read return Integer; private V : Integer; end Prot_RW; overriding procedure Read (Obj : Prot_RW; X : out Integer); (Credits: this example was shamelessly stolen from John Barnes' Rationale document.) !corrigendum 6.3.1(24) @dinsa Two @fas are @i if they are both @fas or are both @fas, the @fas (if any) denote the same subtype, and the corresponding @fas of the @fas (if any) fully conform. @dinst The @i of a subprogram is the profile obtained by omitting the first parameter of that subprogram. There is no prefixed view profile for a parameterless subprogram. For the purposes of defining subtype and mode conformance, the convention of a prefixed view profile is considered to match that of either an entry or a protected operation. !corrigendum 9.1(9.1/1) !comment This includes the wording change from AI-401 (deleting a paragraph). @dinsa For a task declaration without a @fa, a @fa without @fas is assumed. @dinss For a @fa, if the first parameter of a primitive inherited subprogram is of the task type or an access parameter designating the task type, and there is an @fa for a single entry with the same identifier within the @fa, whose profile is type conformant with the prefixed view profile of inherited subprogram, the inherited subprogram is said to be @i by the conforming task entry. @i<@s8> A task declaration requires a completion, which shall be a @fa, and every @fa shall be the completion of some task declaration. Each @fa of an @fa appearing within a @fa shall denote a limited interface type that is not a protected interface. For each primitive subprogram inherited by the type declared by a @fa, at most one of the following shall apply: @xbullet @xbullet If neither applies, the inherited subprogram shall be a null procedure. !corrigendum 9.4(11) !comment This includes the wording change from AI-401 (deleting a paragraph). @dinsa A @fa defines a protected type and its first subtype. The list of @fas of a @fa, together with the @fa, if any, is called the visible part of the protected unit. The optional list of @fas after the reserved word @b is called the private part of the protected unit. @dinss For a @fa, if the first parameter of a primitive inherited subprogram is of the protected type or an access parameter designating the protected type, and there is a @fa for a protected subprogram or single entry with the same identifier within the @fa, whose profile is type conformant with the prefixed view profile of the inherited subprogram, the inherited subprogram is said to be @i by the conforming protected subprogram or entry. @i<@s8> A protected declaration requires a completion, which shall be a @fa, and every @fa shall be the completion of some protected declaration. Each @fa of an @fa appearing within a @fa shall denote a limited interface type that is not a task interface. For each primitive subprogram inherited by the type declared by a @fa, at most one of the following shall apply: @xbullet @xbullet If neither applies, the inherited subprogram is a null procedure. If an inherited subprogram is implemented by a protected procedure or an entry, then the first parameter of the inherited subprogram shall be of mode @b or @b, or an access-to-variable parameter. If a protected subprogram declaration has an @fa, then: @xbullet is @b, then the subprogram shall implement an inherited subprogram, at the point of the declaration;> @xbullet is @b, then the subprogram shall not implement any inherited subprogram (at any point).> !corrigendum 9.5.2(2) @drepl @xcode<@fa defining_identifier [(discrete_subtype_definition)] parameter_profile;>> @dby @xcode<@fa defining_identifier [(discrete_subtype_definition)] parameter_profile;>> !corrigendum 9.5.2(10) @dinsa An @fa is allowed only in a protected or task declaration. @dinst An @fa is not allowed in an @fa that includes a @fa. !corrigendum 9.5.2(13) @dinsa An @fa in a task declaration shall not contain a specification for an access parameter (see 3.10). @dinss If an @fa has an @fa, then: @xbullet is @b, then the entry shall implement an inherited subprogram, at the point of the declaration;> @xbullet is @b, then the operation shall not implement any inherited subprogram (at any point).> !ACATS test ACATS B-Test(s) should be created to check that overriding indicators are allowed and enforced here. !appendix ****************************************************************