From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 23 Sep 93 21:54:09 GMT From: olivea!news.bu.edu!inmet!spock!stt@uunet.uu.net (Tucker Taft) Subject: Re: Question on Ada 9X vs Ada 83. Message-ID: List-Id: In article info@xinotech.com (Brian Hanson) writes: >I have a question about a compability issue and wonder if anyone on the >net >knows the answer or knows whom I could direct my question. > >The issue is "Derived type inherits all operations of Parent". > >An example is > > package P is > type Some_Array is array (1 .. 10) of Integer; > function "&" (Left, Right: Some_Array) return Some_Array; > type New_Array is new Some_Array; > end P; > >I understand that in Ada 9X, New_Array inherits "&" from Some_Array and >that does not happen in Ada 83. > >The my questions are: > 1 - Would this happen if these declarations were in a procedure body? Yes. When a primitive operation is overridden, the overriding operation becomes primitive as well, and is hence available for being inherited on (subsequent) derivation (see RM9X-3.2.3(2);3.0/4.0 last sentence). > 2 - If the function declaration was moved after the type declaration >for > New_Array would New_Array still inherit the "&" function from > Some_Array? No, a type only inherits primitive operations that are visible at the point of the derivation (RM9X-3.4(16);3.0/4.0). So New_Array would inherit the predefined "&" instead of the user-defined one if the user-defined "&" were declared after the point of derivation. >I have tried to figure this out by reading the Ada 9X RM but it was not >very clear to me. I hope the above citations help. >Brian Hanson S. Tucker Taft stt@inmet.com Ada 9X Mapping/Revision Team Intermetrics, Inc. Cambridge, MA 02138