From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b14a804025dceb20 X-Google-Attributes: gid103376,public From: Francois Godme Subject: Re: Constructors/Destructors in Ada95 Date: 2000/10/23 Message-ID: <39F4AE95.4DB04145@bigfoot.com>#1/1 X-Deja-AN: 684983869 Content-Transfer-Encoding: 7bit References: <39EE160D.F0A2000@bigfoot.com> <39EF5431.BF4CD793@bigfoot.com> <39F0A6C7.E592AFFB@averstar.com> X-Accept-Language: fr, en-US, en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@proxad.net X-Trace: nnrp2.proxad.net 972336627 212.27.36.198 (Mon, 23 Oct 2000 23:30:27 CEST) Organization: Guest of ProXad - France MIME-Version: 1.0 NNTP-Posting-Date: Mon, 23 Oct 2000 23:30:27 CEST Newsgroups: comp.lang.ada Date: 2000-10-23T00:00:00+00:00 List-Id: I would like to add some other arguments not yet expressed: * against the non-primitive procedures used as constructors of limited instances like in Tucker Taft's proposal, * against the Adjust procedure and * against the Finalize procedure. I. Non-primitive procedures used as constructors of limited instances: As limited instances can't be initialized with record aggregates, it is possible to write code which forgets to initialize all record fields. It was already the case in Ada83 but only in the horizontal plane. With procedures, it can now get wrong in the vertical plane along the class hierarchy if one forgot to call one of the initializing procedures of its immediate super-class. Programmers have also to remember to call the super-class procedure first as a precaution before initializing extension record fields. Nothing insurmountable I admit. If the language had constructors, the compiler could warn me when I forgot something in the horizontal or the vertical plane. This will increase safety. This doesn't apply to non-limited types if they are initialized only with aggregates and functions. No procedures. II.The Adjust procedure: Efficiency concerns may be raised against the sequence: Finalize (Target); shallow copy Source into Target; Adjust (Target);. In the Adjust procedure, control is given to perform, for instance, a deep copy of Source into Target. One can easily devise situations where Finalize of Target will have to deallocate memory which will be immediately needed and reallocated by Adjust of Target. III. The Finalize procedure: The programmers are responsible in the Finalize procedure to call last the immediate super-class Finalize procedure. As the notion of immediate super-class does not exist in the language, it is not possible to write code that will always call the Finalize procedure of the immediate super-class.