From rybin@possum.srcc.msu.su Mon Mar 3 06:21:39 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id GAA12132; Mon, 3 Mar 1997 06:21:38 -0500 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA05104; Mon, 3 Mar 97 06:22:00 EST Received: from crocus.gamma.ru by sw-eng.falls-church.va.us (8.7.1/) id KAA07873; Mon, 3 Mar 1997 10:23:16 GMT Received: from srcc.UUCP (uucp@localhost) by crocus.gamma.ru (8.7.6/8.7.3) with UUCP id NAA05565 for asis-comment@sw-eng.falls-church.va.us; Mon, 3 Mar 1997 13:25:52 +0300 (MSK) Received: by gamma.srcc.msu.su; Mon, 3 Mar 1997 13:25:00 +0300 Received: by possum.srcc.msu.su (UUPC/@ v5.09gamma, 14Mar93); Mon, 3 Mar 1997 12:57:22 +0300 To: asis-comment@sw-eng.falls-church.va.us Cc: rybin@crocus.gamma.ru Message-Id: Organization: Information Systems, SRCC, MSU From: "Sergey I. Rybin" Date: Mon, 3 Mar 97 12:57:21 +0300 X-Mailer: BML [MS/DOS Beauty Mail v.1.36] Subject: Root and universal types in ASIS Lines: 76 Content-Length: 2879 Status: OR !topic Root an universal types in ASIS !reference ASIS 95-16.7, 3.11.13 !from Sergey Rybin !keywords A_Root_Type_Definition, Corresponding_Root_Type, semantic queries !discussion What should be returned by Asis.Definitions.Corresponding_Root_Type (its definition is appended to this comment) in the following situation: type My_Int is range -100 .. 100; type My_New_Int is new My_Int; ^^^^^^^^^^^ | Elem What should be the result of Corresponding_Root_Type (Elem): the declaration of My_Int or the artificial declaration of the root_integer type? RM95 3.5.4 (14) says: A type defined by an integer_type_definition is implicitly derived from root_integer, an anonymous predefined (specific) integer type, whose base range is System.Min_Int .. System.Max_Int. However, the base range of the new type is not inherited from root_integer, but is instead determined by the range or modulus specified by the integer_type_definition. Integer literals are all of the type universal_integer, the universal type (see 3.4.1) for the class rooted at root_integer, allowing their use with the operations of any integer type. It gives the formal background for returning the definition of root_integer. From the other side, returning the definition of the user-defined type My_Int seems to be much more useful from an application's viewpoint. And the definition of Corresponding_Root_Type does not give the final answer. I think, that the clarification comments should be added to Corresponding_Root_Type. My opinion is that this function should not return definition of root integer types. Another problem is that the ASIS says nothing about how the types of Root_Type_Kinds may be obtained. I think some clarification comments should be added. Sergey Rybin. --------------------------------------------------------------------- ------------------------------------------------------------------------------ -- Section 16.7 function Corresponding_Root_Type ------------------------------------------------------------------------------ function Corresponding_Root_Type (Type_Definition : in Asis.Type_Definition) return Asis.Declaration; ------------------------------------------------------------------------------ -- Type_Definition - Specifies the derived_type_definition to query -- -- This function recursively unwinds all type derivations and subtyping to -- arrive at a full_type_declaration that is neither a derived type or a -- subtype. -- -- Appropriate Type_Kinds: -- A_Derived_Type_Definition -- A_Derived_Record_Extension_Definition -- -- Returns Declaration_Kinds: -- An_Ordinary_Type_Declaration -- A_Task_Type_Declaration -- A_Protected_Type_Declaration -- A_Formal_Type_Declaration -- From sblake@alsys.com Tue Mar 11 12:50:04 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id MAA00222; Tue, 11 Mar 1997 12:50:03 -0500 Received: from sw-eng.falls-church.va.us (ns1.sw-eng.falls-church.va.us) by ida.org (4.1/SMI-4.1) id AA18196; Tue, 11 Mar 97 12:50:29 EST Received: from gw.alsys.com by sw-eng.falls-church.va.us (8.7.1/) id RAA25181; Tue, 11 Mar 1997 17:31:34 GMT Received: from rasht.alsys.com (mailhub.alsys.com) by gw.alsys.com (4.1/SMI-4.1.1) id AA08554; Tue, 11 Mar 97 09:34:40 PST Received: from puumba.telesoft by rasht.alsys.com (4.1/TS-1.2c) id AA17364; Tue, 11 Mar 97 09:33:46 PST Received: by puumba.telesoft (SMI-8.6/SMI-SVR4) id JAA13210; Tue, 11 Mar 1997 09:33:44 -0800 Date: Tue, 11 Mar 1997 09:33:44 -0800 From: sblake@alsys.com (Steve Blake @pulsar) Message-Id: <199703111733.JAA13210@puumba.telesoft> To: asis-comment@sw-eng.falls-church.va.us, rybin@possum.srcc.msu.su Subject: Re: Root and universal types in ASIS Cc: rybin@crocus.gamma.ru Content-Length: 1041 Status: OR >What should be returned by Asis.Definitions.Corresponding_Root_Type >(its definition is appended to this comment) in the following situation: > >type My_Int is range -100 .. 100; > >type My_New_Int is new My_Int; > ^^^^^^^^^^^ > | > > Elem > >What should be the result of Corresponding_Root_Type (Elem): the declaration >of My_Int or the artificial declaration of the root_integer type? > ... >I think, that the clarification comments should be added to >Corresponding_Root_Type. My opinion is that this function should not >return definition of root integer types. > >Another problem is that the ASIS says nothing about how the types of >Root_Type_Kinds may be obtained. I think some clarification comments >should be added. > >Sergey Rybin. I agree. Return the useful root_type for the class, in this case My_Int. I think the only way to obtain an element of a Root_Type_Kind is Type_Declaration_View(Corresponding_Expression_Type(Int_Literal_Expression)) Steve Blake