!standard 11.4.1 (3) 00-10-04 AI95-00241/01 !class amendment 00-10-04 !status work item 00-10-04 !status received 00-10-04 !priority Medium !difficulty Easy !subject Testing for Null_Occurrence !summary Function Is_Null_Occurrence is added to Ada.Exceptions. !problem Ada.Exceptions exports the constant Null_Occurrence, but doesn't provide any way to test whether a given exception occurrence is Null_Occurrence (type Exception_Occurrence is limited). !proposal We propose that a function should be added to Ada.Exceptions that would allow testing whether an exception occurrence is Null_Occurrence. !wording Add the following to Ada.Exceptions (11.4.1(3)): function Is_Null_Occurrence (X : Exception_Occurrence) return Boolean; Add the following after 11.4.1(7): Is_Null_Occurrence yields True if the argument is Null_Occurrence, and False otherwise. !example !discussion When logging information, an application probably will use Null_Occurrence to represent the absence of an exception. When displaying the log, it is necessary to determine whether a particular occurrence is Null_Occurrence, or an occurrence containing information about an exception. A Constraint_Error handler can be used for this purpose, but it is awkward, does not reflect the fact that this is a normal case, and potentially can mask other errors. !appendix !topic Testing for Null_Occurrence !reference RM95-11.4.1(3) !from Gary Dismukes (for Ada Core Technologies) !keywords Ada.Exceptions, Null_Occurrence !discussion Ada.Exceptions exports the constant Null_Occurrence, but doesn't provide any way to test whether a given exception occurrence is Null_Occurrence (type Exception_Occurrence is limited). We propose that a function should be added to Ada.Exceptions that would allow testing whether an exception occurrence is Null_Occurrence. In GNAT, we have added a child function Ada.Exceptions.Is_Null_Occurrence for this purpose: -- This is a GNAT-specific child function of Ada.Exceptions. It provides -- clearly missing functionality for its parent package, and most reasonably -- would simply be an added function to that package, but this change cannot -- be made in a conforming manner. function Ada.Exceptions.Is_Null_Occurrence (X : Exception_Occurrence) return Boolean; -- This function yields True if X is Null_Occurrence, and False otherwise **************************************************************** From: Tucker Taft Sent: Friday, September 22, 2000 9:19 PM I believe the original intent was that: Exception_Identity(Null_Occurrence) = Null_Id providing a mechanism for testing for Null_Occurrence, but I see that 11.4.1(14) contradicts that by indicating that Exception_Identity raises Constraint_Error in this case. I think that is a mistake, though others might remember otherwise. > function Ada.Exceptions.Is_Null_Occurrence > (X : Exception_Occurrence) > return Boolean; > -- This function yields True if X is Null_Occurrence, and False otherwise This seems like a reasonable proposal, in any case, although it is obviously an amendment, not an interpretation. **************************************************************** From: Robert Dewar Sent: Friday, September 22, 2000 10:03 PM <> Well I would be happy to allow this identity, though this would be a change (in GNAT we could add a child, but not change clear RM semantics), but if one is in the amendment business, perhaps allowing the above identity is the cleanest approach. ****************************************************************