From rybin@possum.srcc.msu.su Thu Mar 20 15:50:03 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id PAA20002; Thu, 20 Mar 1997 15: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 AA20690; Thu, 20 Mar 97 15:50:27 EST Received: from crocus.gamma.ru by sw-eng.falls-church.va.us (8.7.1/) id TAA12334; Thu, 20 Mar 1997 19:57:52 GMT Received: from srcc.UUCP (uucp@localhost) by crocus.gamma.ru (8.8.5/8.7.3) with UUCP id WAA00651 for asis-comment@sw-eng.falls-church.va.us; Thu, 20 Mar 1997 22:59:49 +0300 (MSK) Received: by gamma.srcc.msu.su; Thu, 20 Mar 1997 20:49:16 +0300 Received: by possum.srcc.msu.su (UUPC/@ v5.09gamma, 14Mar93); Thu, 20 Mar 1997 20:47:06 +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: Thu, 20 Mar 97 20:47:06 +0300 X-Mailer: BML [MS/DOS Beauty Mail v.1.36] Subject: body of a library subprogram without separate spec Lines: 114 Content-Length: 4258 Status: OR !topic SHould Library_Unit_Declaration return the body of a library procedure? !reference ASIS 95-10.6, 10.8 !from Sergey Rybin !keywords Library_Unit_Declaration !discussion I've got the following question from Bill Thomas: > Another problem was that I was using testing this on a procedure, > and calling library_unit_declaration for a library level procedure > that does not have an expilict spec returned a Nil_Compilation_Unit. > When I created a spec, it worked OK. Am I correct that > Library_Unit_Declaration should return the body for a library level > procedure that does not have an explicit spec? This question has refreshed my own doubts concerning Library_Unit_Declaration, Library_Unit_Declarations and the case, when a library level procedure has no explicit separate spec. I am afraid, Bill and me are not the only two persons who are confused by this issue, so it would make sense to clarify it in ASIS. Moreover, why do these queries have no lists of returned unit kinds? May be, to add explicit returned lists would be the simplest way to fix this hole? My answer to Bill's question is appended. Sergey Rybin. This question gives the good reason to send a message to asis-comment. Some time ago I thought, that the answer should be "yes", but then I changed my mind, because of the following reasons: 1. the body for a library level procedure should be classified as A_Procedure_Body, whether or not a separate spec exist in the Context (library); 2. Asis.Compilation_Units says: ------------------------------------------------------------------------------ -- Section 10.6 function Library_Unit_Declaration ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ function Library_Unit_Declaration (Name : in String; The_Context : in Asis.Context) return Asis.Compilation_Unit; ------------------------------------------------------------------------------ -- Name - Specifies the defining program unit name -- The_Context - Specifies a program Context environment -- -- Returns the library_unit_declaration or library_unit_renaming_declaration -- with the name, contained in The_Context. -- -- A Nil_Compilation_Unit is returned if no such declaration exists. -- 3. RM95 10.1.1 defines the following syntax rules: Syntax 2 compilation ::= {compilation_unit} 3 compilation_unit ::= context_clause library_item | context_clause subunit 4 library_item ::= [private] library_unit_declaration | library_unit_body | [private] library_unit_renaming_declaration 5 library_unit_declaration ::= subprogram_declaration | package_declaration | generic_declaration | generic_instantiation Therefore, if the result of Library_Unit_Declaration should represent "library_unit_declaration or library_unit_renaming_declaration", this query should NOT return a body. But, from the other side, the Asis package contains somewhat confusing wording: ------------------------------------------------------------------------------ -- Section 3.14.1 type Unit_Kinds ------------------------------------------------------------------------------ -- ... type Unit_Kinds is ( ... A_Procedure_Body, -- A unit interpreted only as the completion -- of a procedure, or a unit interpreted as -- both the declaration and body of a library -- procedure. RM 95 10.1.4(4) A_Function_Body, -- A unit interpreted only as the completion -- of a function, or a unit interpreted as -- both the declaration and body of a library -- function. RM 95 10.1.4(4) I think I should send the text above to asis-comment, because the issue definitely needs clarification. My opinion still is that a body should not be returned, but this (or the opposite thing, if I'm wrong) should definitely be said explicitly in the ASIS definition. From sblake@alsys.com Fri Mar 21 11:10:53 1997 Return-Path: Received: from ida.org by cronus.csed.ida.org (SMI-8.6/SMI-SVR4) id LAA22791; Fri, 21 Mar 1997 11:10:53 -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 AA03595; Fri, 21 Mar 97 11:11:18 EST Received: from gw.alsys.com by sw-eng.falls-church.va.us (8.7.1/) id QAA06614; Fri, 21 Mar 1997 16:04:43 GMT Received: from rasht.alsys.com (mailhub.alsys.com) by gw.alsys.com (4.1/SMI-4.1.1) id AA05123; Fri, 21 Mar 97 08:07:52 PST Received: from puumba.telesoft by rasht.alsys.com (4.1/TS-1.2c) id AA26220; Fri, 21 Mar 97 08:06:55 PST Received: by puumba.telesoft (SMI-8.6/SMI-SVR4) id IAA07769; Fri, 21 Mar 1997 08:06:54 -0800 Date: Fri, 21 Mar 1997 08:06:54 -0800 From: sblake@alsys.com (Steve Blake @pulsar) Message-Id: <199703211606.IAA07769@puumba.telesoft> To: asis-comment@sw-eng.falls-church.va.us, rybin@possum.srcc.msu.su Subject: Re: body of a library subprogram without separate spec Cc: rybin@crocus.gamma.ru Content-Length: 130 Status: OR Clarification would be good. My opinion is like Sergey's, the body should not be returned by Library_Unit_Declaration. Steve