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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3d9f3074dc2c4699 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: How to overload assignment in Ada 95? Date: 1996/12/09 Message-ID: #1/1 X-Deja-AN: 203265846 distribution: usa references: <58aclh$ssd@gaia.cc.gatech.edu> content-type: text/plain; charset=ISO-8859-1 organization: Estormza Software mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-12-09T00:00:00+00:00 List-Id: In article , bbalfour@std.caci.com (Brad Balfour) wrote: >In article <58aclh$ssd@gaia.cc.gatech.edu>, chrisc@cc.gatech.edu >(Christopher D Carothers) wrote: > >> In 7.6 of the Ada95 LRM, it talks about >>user-defined assignment. Could someone please >>provide me with an example of how I would in fact >>"overload" the assignment operator for a particular >>package. The LRM talks about the Ada.Finalization >>package and the the "Adjust" procedure. However, >>it does not give an example of how I would use >>this package to achieve the "overloading" of assignment. > >I wrote up an example of this for an article in ACM SIGAda's Ada Letters >magazine in Vol. XIV, No. 5, September/October, 1994. >An online copy of this article can be found at: >http://www.acm.org/~bbalfour/tips_no_1.html Does anyone have a rule of thumb for when a controlled type should publicly derive from type Ada.Finalization.Controlled? For example with Ada.Finalization; ... package Unbounded_Stacks is type Unbounded_Stack is new Ada.Finalization.Controlled with private; ... versus with Ada.Finalization; ... package Unbounded_Stacks is type Unbounded_Stack is private; ... private type Unbounded_Stack is new Ada.Finalization.Controlled with record ... end record; ... In the former case, clients of the Unbounded_Stack have direct visibility to the operations Initialize, Finalize, and Adjust. When is this a good thing? A bad thing? -------------------------------------------------------------------- Matthew Heaney Software Development Consultant mheaney@ni.net (818) 985-1271