Version 1.3 of si99s/si99-0056-1.txt
!standard 16.28 10-03-04 SI99-0056-1/02
!standard F.6.4
!class Binding Interpretation 09-10-12
!status ARG Approved 7-0-2 10-02-26
!status work item 09-10-12
!status received 09-10-12
!priority High
!difficulty Easy
!qualifier Omission
!subject Information about components defined by an access_definition
!summary
A new query is added, Component_Declaration_Subtype, that returns either
a subtype_indication or an access_definition.
The query Component_Subtype_Indication is made obsolescent.
!question
In Ada 95, a component definition could only be a subtype definition,
and the only applicable query was Component_Subtype_Indication. In Ada
2005, a component definition can also be an access_definition;
however, there is no way to check what kind of component it is, nor to
retrieve the access_definition. Is this omission intended? (No).
!recommendation
(See summary.)
!wording
Move 16.28 to annex F as clause F.6.4, and replace it with:
16.28 function Component_Definition_Subtype
function Component_Definition_Subtype
(Component_Definition : Asis.Component_Definition)
return Asis.Definition;
Component_Definition specifies the Component_Definition to query.
Returns the subtype_indication or access definition of the
Component_Definition.
Component_Definition expects an element that
has the following Definition_Kinds:
A_Component_Definition
Raises ASIS_Inappropriate_Element with a Status of Value_Error for any
element that does not have one of these expected kinds.
Returns an element that has one of the following Definition_Kinds:
A_Subtype_Indication
An_Access_Defintion
The beginning of the new clause F.6.4 is:
F.6.4 function Component_Subtype_Indication
This function has been replaced by Component_Definition_Subtype. Use of the
function Component_Subtype_Indication is not recommended in new programs.
!discussion
The name Component_Definition_Subtype has been chosen for consistency
with Object_Declaration_Subtype; Component_Definition_View could be chosen
for consistency with Object_Declaration_View.
!appendix
From: Jean-Pierre Rosen
Sent: Tuesday, September 8, 2009 3:28 AM
To make sure I didn't miss something before filing an SI...
How do you know that a record component is of anonymous access type?
Object_Declaration_Subtype (formerly Object_Declaration_View), when applied
to A_Component_Declaration, returns A_Component_Definition.
The only query that takes A_Component_Definition as input is
Component_Subtype_Indication (with A4G, it returns a Nil_Element when called
on an access_definition; arguable, but...).
I couldn't find anything that tells if the component definition is an
access_definition, or returns it (and I don't think this is something for
the semantic subsystem - it is clearly structural). An omission?
****************************************************************
From: Sergey I. Rybin
Sent: Tuesday, September 8, 2009 3:37 AM
Yes, looks like an omission indeed...
In GNAT ASIS 2005, I've added a new query:
-- 16.#??? function Component_Definition_View
------------------------------------------------------------------------------
function Component_Definition_View
(Component_Definition : Asis.Component_Definition)
return Asis.Definition;
-- --|D2005 start
-- Is it a good name for the query?
-- --|D2005 end
------------------------------------------------------------------------------
-- Component_Definition - Specifies the Component_Definition to query
--
-- Returns the subtype_indication or access_definition of the
-- Component_Definition.
--
-- Appropriate Definition_Kinds:
-- A_Component_Definition
--
-- Returns Definition_Kinds:
-- A_Subtype_Indication
-- An_Access_Definition
--
****************************************************************
From: Ed Schonberg
Sent: Wednesday, September 9, 2009 9:24 AM
> I couldn't find anything that tells if the component definition is an
> access_definition, or returns it (and I don't think this is something
> for the semantic subsystem - it is clearly structural). An omission?
Couldn't you ask for the Type_Kind of the Component_Definition?
function Type_Kind takes any definition.
****************************************************************
From: Jean-Pierre Rosen
Sent: Wednesday, September 9, 2009 9:33 AM
> Couldn't you ask for the Type_Kind of the Component_Definition?
> function Type_Kind takes any definition.
>
Not any definition, just A_Type_Definition, and here we have
A_Component_Definition...
Maybe Trait_Kind would work, but in Ada95 it is not supposed to handle
A_Component_Definition, and in Ada2005 it is obsolescent...
****************************************************************
From: Sergey I. Rybin
Sent: Wednesday, September 9, 2009 10:20 AM
> Maybe Trait_Kind would work, but in Ada95 it is not supposed to handle
> A_Component_Definition, and in Ada2005 it is obsolescent...
I would not put Trait_Kind back. I have it in GNAT ASIS 2005, and it is a huge pain...
****************************************************************
From: Ed Schonberg
Sent: Wednesday, September 9, 2009 12:11 PM
>> Couldn't you ask for the Type_Kind of the Component_Definition?
>> function Type_Kind takes any definition.
>>
> Not any definition, just A_Type_Definition, and here we have
> A_Component_Definition...
Indeed. So the omission is real, an SI is needed
****************************************************************
From: Jean-Pierre Rosen
Sent: Thursday, September 10, 2009 3:13 AM
I will do, but procedurally speaking, is it better to submit it now, or
as part of AFNOR comments?
****************************************************************
From: Randy Brukardt
Sent: Thursday, September 10, 2009 2:23 PM
I don't think it matters. As long as it is available long before the next
meeting, it is fine. And the AFNOR comments are due pretty soon (October 1,
if I remember correctly). If there was a significant time difference, it
would matter.
****************************************************************
Questions? Ask the ACAA Technical Agent