From rybin@alex.srcc.msu.su Wed Nov 6 03:17:04 1996 Return-Path: Received: from ida.org by csed-115.csed.ida.org (SMI-8.6/SMI-SVR4) id DAA05214; Wed, 6 Nov 1996 03:17:01 -0500 Received: from crocus.gamma.ru by ida.org (4.1/SMI-4.1) id AA27030; Wed, 6 Nov 96 03:15:27 EST Received: from srcc.UUCP (uucp@localhost) by crocus.gamma.ru (8.7.6/8.7.3) with UUCP id LAA23013; Wed, 6 Nov 1996 11:14:04 +0300 (MSK) Received: by gamma.srcc.msu.su; Wed, 6 Nov 1996 11:13:22 +0300 Received: by vadik.srcc.msu.su; Wed, 6 Nov 1996 11:10:22 +0300 Received: by alex.srcc.msu.su (UUPC/@ v5.09gamma, 14Mar93); Wed, 6 Nov 1996 11:11:54 +0300 To: colket@smtp-gw.spawar.navy.mil, roby@ida.org Cc: asis-technical@sw-eng.falls-church.va.us Message-Id: Organization: Research Computing Center, Moscow State University From: Rybin Sergey Igorevich Date: Wed, 6 Nov 96 11:11:54 +0300 X-Mailer: BML [MS/DOS Beauty Mail v.1.36] Subject: Normalized associations from calls to attributes-subprograms Lines: 121 Content-Length: 5424 Status: OR Currie, Clyde and all, last week Steve and me had some technical discussion about normalised association lists obtained from subprogram calls. We have came to the common point about the problem being discussed, and below is the summary from this discussion. Sergey Rybin. =================================================================== There are two queries in ASIS95 for obtaining the association list from a subprogram or entry call - Asis.Expressions.Function_Call_Parameters for functions and Asis.Statements.Call_Statement_Parameters for procedures and entries. Both these queries have the Normalized parameter. The problem is that a function call may be a call to an attribute-function (such as P'Pred (X) or T'Max (Y,Z),and a procedure call may be a call to a attribute-procedure (such as T'Read (Var)), and the existing documentation of these two queries does not cover situations, when a call being decomposed is the call to attribute-subprogram, and the Normalized parameter is set True. The discussion for Function_Call_Parameters and Call_Statement_Parameters is the same, so consider Function_Call_Parameters as an example: Asis.Expressions.Function_Call_Parameters says: ------------------------------------------------------------------------------ function Function_Call_Parameters (Expression : in Asis.Expression; Normalized : in Boolean := False) return Asis.Association_List; ------------------------------------------------------------------------------ -- Expression - Specifies the function call expression to query -- Normalized - Specifies whether the normalized form is desired -- -- Returns a list of parameter_associations of the call. -- -- Returns a Nil_Element_List if there are no parameter_associations. -- -- An unnormalized list contains only explicit associations ordered as they -- appear in the program text. Each unnormalized association has an optional -- formal_parameter_selector_name and an explicit_actual_parameter component. -- -- A normalized list contains artificial associations representing all -- explicit and default associations. It has a length equal to the number of -- parameter_specifications of the formal_part of the -- parameter_and_result_profile. The order of normalized associations matches -- the order of parameter_specifications. -- -- Each normalized association represents a one on one mapping of a -- parameter_specifications to the explicit or default expression. -- A normalized association has one A_Defining_Name component that denotes the -- parameter_specification, and one An_Expression component that is either the -- explicit_actual_parameter or a default_expression. -- -- Appropriate Expression_Kinds: -- A_Function_Call -- -- Returns Element_Kinds: -- A_Parameter_Association -- --|IR Implementation Requirements: --|IR --|IR Normalized associations are Is_Normalized and Is_Part_Of_Implicit. --|IR Normalized associations provided by default are Is_Defaulted_Association. --|IR Normalized associations are never Is_Equal to unnormalized associations. --|IR --|IP Implementation Permissions: --|IP --|IP An implementation may choose to always include default parameters in its --|IP internal representation. --|IP --|IP An implementation may also choose to normalize its representation --|IP to use defining_identifiers rather than formal_parameter_selector_names. --|IP --|IP In either case, this query will return Is_Normalized associations even if --|IP Normalized is False, and the query Function_Call_Parameters_Normalized --|IP will return True. -- ------------------------------------------------------------------------------ Ada does not allow the positional associations for calls to functions-attributes. I failed to find any place where it is said explicitly, but function-attributes have no declarations (neither explicit nor implicit), so there cannot be any visible declarations for any formal parameter name from such a call. The questions are: - should ASIS allow obtaining normalized component list from a call to attribute-function? - if it should, what is a normalized parameter association for a call to attribute-function? Our suggestion is: 1. Calls with the Normalized parameter set True should be allowed for all function calls and procedure calls, including cases when the called entity is an attribute. (It does not make any formal contradiction with Ada, because normalized associations are entirely ASIS internal notion.) Another solution may be to raise Asis_Inappropriate_Element, but it would have at least two disadvantagies - first, it would change the existing semantics of these queries, second, it would force an application to use additional exception handlers to deal with possible exceptions. 2. Normalised associations obtained from calls to attributes-subprograms should test Is_Normalized, it could never be Is_Defaulted_Association. 3. When further decomposed, a Normalised association obtained from a call to an attributes-subprogram should yield Nil_Element as a formal parameter (a result of Asis.Expressions.Formal_Parameter. The corresponding statements should be added to the documentation of Asis.Expressions.Function_Call_Parameters, Asis.Statements.Call_Statement_Parameters and Asis.Expressions.Formal_Parameter.