CVS difference for ais/ai-00199.txt
--- ais/ai-00199.txt 2000/03/14 00:05:55 1.9
+++ ais/ai-00199.txt 2000/04/14 01:45:08 1.10
@@ -1,241 +1,29 @@
-!standard 10.01.05 (07) 00-03-07 AI95-00199/06
+!standard 10.01.05 (07) 00-04-13 AI95-00199/07
!class binding interpretation 98-03-27
-!status Corrigendum 2000 99-07-27
+!status deleted 00-04-13
!status WG9 approved 99-06-12
!status ARG approved (with editorial changes) 8-0-2 99-03-25
!status work item 98-04-02
!status received 98-03-27
-!reference AI95-00041
+!reference AI-00041
!priority High
!difficulty Hard
!qualifier Clarification
-!subject Pragma Convention for a generic unit applies to its instances
+!subject (Deleted)
!summary
-The following Implementation Advice is added:
+This AI has been merged into AI95-00041.
- Program unit pragmas that are not library-unit pragmas, when
- supported for a generic unit, should apply to all instances of the
- generic for which there is not an overriding pragma applied directly
- to the instance.
-
-This Implementation Advice answers the question left open by AI-00041.
-
!question
-Does pragma convention for a generic unit apply to
-instances? (Yes, if supported.)
-
!recommendation
-There are four language-defined program unit pragmas which are
-not library-unit pragmas:
-
- - pragma Inline
-
- - pragma Convention
-
- - pragma Import
-
- - pragma Export
-
-AI-00041 addressed the question of whether program unit pragmas applied
-to a generic, should also apply to its instances. It concluded they
-should not, in general, with pragma Inline as an exception, and
-with the claim that pragmas Convention, Import, and Export (the
-interfacing pragmas) do not in any case apply to generics.
-
-However, there is nothing precluding implementations from supporting
-the interfacing pragmas for generic units. The natural interpretation
-for this is that the pragmas apply to all instances of the generic unit.
-
-In general, AI-00041's conclusions that library unit pragmas on
-generics should not apply to instances makes sense, because there
-is no requirement that the instances be library units at all.
-However, for program unit pragmas that are not library unit pragmas,
-the most intuitive interpretation is that when applied to generic
-program units, they are "inherited" by the instances of the generic.
-For each of the four language-defined non-library-unit program unit
-pragmas, this rule makes sense, and it seems reasonable to assume
-that it would make sense for other similar pragmas. Of course, an
-implementation could always define a new "program-unit-ish" pragma
-for which it did not make sense, but implementations are allowed
-to define whatever semantics they choose for implementation-defined
-pragmas (subject to the usual recommendations about "good taste"
-in pragmas).
-
-Although a program unit pragma on a generic should generally be
-"inherited" by its instances, it might be overridden by a pragma applied
-directly to the instance. This is analogous to the rule
-for inheriting representation items by a derived type from
-its parent type. The inherited specification may be overridden
-by a direct specification on the derived type itself.
-
!wording
-(See summary.)
-
!discussion
-AI-00041 includes a thorough analysis of all program-unit pragmas
-applicable to generic units other than the interfacing pragmas,
-and concludes that with the exception of pragma Inline, instances
-should not inherit pragmas from generic units. However, if the
-program-unit pragmas are instead separated into two groups, those which
-are library unit pragmas, and all others, it becomes more natural to
-say that only library unit pragmas are not "inherited" by instances
-(since of course the instances might not themselves be library units),
-whereas all other program unit pragmas are "inherited" by instances.
-
-The contention in AI-00041 that the interfacing pragmas simply
-don't apply to generics is not true in some implementations.
-For those implementations that do support interfacing pragmas
-on generics, it seems that the natural interpretation is for
-the pragmas to be inherited by all instances.
-
-Even though we propose that non-library unit program unit pragmas should be
-inherited by instances, we still want to allow overriding of
-such a pragma with one applied directly to the instance.
-Hence, even if a convention is specified on a generic,
-a pragma on a particular instance may override that convention.
-
-!corrigendum 10.01.05(7)
-
-@dinsa
-Certain program unit pragmas are defined to be @i<library unit pragmas>. The
-name, if any, in a library unit pragma shall denote the declaration of a
-library unit.
-@dinst
-@i<@s8<Static Semantics>>
-
-A library unit pragma that applies to a generic unit does not apply to its
-instances. Any other program unit pragma that applies to a generic unit applies
-to an instance of the generic unless the instance has an overriding pragma.
-
-
!ACATS test
-This ruling is not testable, because it applies only to implementations
-which choose to support Import/Export/Convention on generic units.
-None of these are required by the language.
-
!appendix
-!section 13.9(3)
-!subject does pragma convention for a generic unit apply to instances?
-!reference AARM-13.9(3a), 13.11.2(3a)
-!from Jesper Jørgensen
-!reference 1998-15798.a Jesper Joergensen 1998-1-29>>
-!discussion
-
-The above mentioned paragraphs seem to imply that convention specified for a
-generic unit is "inherited" to all its instances. Such a rule sounds
-reasonable, but where is the proof in the reference manual?
-
-The same rule could apply for pragma export and perhaps also import. Is that
-the case?
-
-The closest I could get to an answer to this question is AI-00041 which
-unfortunately directly contradicts the above mentioned paragraphs by stating
-that pragma convention, export and import can't be applied to a generic unit. I
-think that AI-00041 is wrong on this!
-
---
-
-+---------------------------------------------------------------------+
-| |
-| \_\_\_\_ \_\_\_\_ \_\_\_\_ \_ |
-| \_ \_ \_ \_ \_ \_ |
-| \_ \_ \_ \_ \_ \_\_\_ \_ |
-| \_ \_ \_ \_ \_ \_ |
-| \_\_\_\_ \_\_\_\_ \_\_\_\_ \_ |
-| |
-| Jesper Jørgensen |
-| DDC-I A/S Phone: +45 45 87 11 44 |
-| Gl. Lundtoftevej 1 B Fax: +45 45 87 22 17 |
-| DK-2800 Lyngby, Denmark Email: jj@ddci.dk |
-+---------------------------------------------------------------------+
-
-****************************************************************
-
-!section 13.9(3)
-!subject does pragma convention for a generic unit apply to instances?
-!reference AARM-13.9(3a), 13.11.2(3a)
-!reference 1998-15798.a Jesper Jørgensen
-!from Tucker Taft 98-01-29
-!reference 1998-15799.a Tucker Taft 1998-1-29>>
-!discussion
-
-: The above mentioned paragraphs seem to imply that convention specified for a
-: generic unit is "inherited" to all its instances. Such a rule sounds
-: reasonable, but where is the proof in the reference manual?
-
-: The same rule could apply for pragma export and perhaps also import. Is that
-: the case?
-
-Yes, I believe that pragmas Convention, Import, and Export
-should all be inherited by the instances of a generic, just
-like pragma Inline.
-
-: The closest I could get to an answer to this question is AI-00041 which
-: unfortunately directly contradicts the above mentioned paragraphs by stating
-: that pragma convention, export and import can't be applied to a generic unit. I
-: think that AI-00041 is wrong on this!
-
-I agree with you. Pragmas convention, export, and import can be
-applied to a generic. For example, it makes perfect sense to
-apply pragma Import(Intrinsic, ...) to the generic function
-Ada.Unchecked_Conversion. It is unlikely that there will be
-a body for this generic written in Ada, but instead its "body"
-will be built into the compiler. Similarly, applying a pragma
-convention to a generic subprogram clearly indicates that instances
-should use the specified calling convention. Finally, applying
-pragma Export to a generic implies that all instances should be
-externally callable, perhaps with a given specified External_Name.
-Specifying a link_name would be tricky, given that having multiple
-instances with the same Link_Name would cause ambiguity at
-link time. However, External_Names could all be the same presuming
-the language to which the instances are being exported supports
-overloading (e.g. Java or C++).
-
-In general, I believe AI-00041 should only apply to library
-unit pragmas. For program unit pragmas that are not library
-unit pragmas (i.e. pragmas Inline, Convention, Export, and Import)
-it makes perfect sense that all instances inherit the pragma.
-For library unit pragmas, it does not make as much sense for the
-instances to inherit the pragmas, mostly because there is no
-requirement that the instances end up being library units at all.
-
-: -- Jesper
-
-: | Jesper Jørgensen |
-: | DDC-I A/S Phone: +45 45 87 11 44 |
-: | Gl. Lundtoftevej 1 B Fax: +45 45 87 22 17 |
-: | DK-2800 Lyngby, Denmark Email: jj@ddci.dk |
-
---
--Tucker Taft stt@inmet.com http://www.inmet.com/~stt/
-Intermetrics, Inc. Burlington, MA USA
-
-****************************************************************
-
-From: Tucker Taft
-Sent: Monday, March 13, 2000 1:24 PM
-
-Erhard Ploedereder wrote:
-> ...
->
-> Finally, I have a question about AI-199 -- Tuck ??
->
-> The AI talks about overriding pragmas on the instances. How do I override
-> Inline, Export, Import ? I?d love to, especially for Inline. :-)
->
-> More seriously, the only pragma that?s overridable is Convention. In that
-> sense, the proposed wording is still correct, but a bit sweeping. Should it
-> be changed ?
-
-We could add some "weasel" words to make it clear that not all pragmas
-have mechanisms for overriding their effect.
-
-****************************************************************
Questions? Ask the ACAA Technical Agent