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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!elma.epfl.ch!madmats From: madmats@elma.epfl.ch (Mats Weber) Newsgroups: comp.lang.ada Subject: Overloading of ":=" Message-ID: <881220140501.20a00495@elcc.epfl.ch> Date: 20 Dec 88 13:05:01 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: In his message dated 3 Dec 88 21:08:16 GMT, mcvax!enea!sommar@uunet.uu.net (Erland Sommarskog) writes: > Generic > Type Data_type is limited private; > With procedure Assign(A : in out Data_type; > B : in Data_type); > With function "<"(A, B : Data_type) return boolean is <>; > With function ">"(A, B : Data_type) return boolean is <>; > Package Binary_trees is > >With an overloadable ":=" I could have declared the second parameter as > > With procedure ":="(A : in out Data_type; > B : in Data_type) is <>; > >This would save the user from declaring unnecessary Assign for types like >integer. This Assign procedure he has to write is simple, but is 100% noise >to his code. Instanciating and using this generic package with Standard.Integer (or any type that does not have a default initial value) is ERRONEOUS because the formal parameter A of Assign or ":=" is of mode 'in out', hence the corresponding actual paramter must be an initialized variable. For more information on this subject, read the paper by Genillard et al. "Rationale for the Design of Reusable Abstract Data Types Implemented in Ada" To appear soon in Ada Letters. Another document that should be read by anyone before even thinking of Ada 9x language changes is "Rationale for the Design of the Ada Programming Language" by Ichbiah et al. Mats Weber Swiss Federal Institute of Technology EPFL DI LITh 1015 Lausanne Switzerland e-mail : madmats@elma.epfl.ch