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.9 required=5.0 tests=BAYES_00,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4f788831da4de764 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-16 14:43:59 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!cambridge1-snf1.gtei.net!news.gtei.net!inmet!not-for-mail From: Tucker Taft Newsgroups: comp.lang.ada Subject: Re: Abstract Functions Date: Mon, 16 Jul 2001 17:43:57 -0400 Organization: AverStar (formerly Intermetrics) Burlington, MA USA Message-ID: <3B53601D.1295AF39@avercom.net> References: <9ihnia$i8h$1@nh.pace.co.uk> <6b_27.15423$Kf3.181711@www.newsranger.com> <9ihs6j$k33$1@nh.pace.co.uk> NNTP-Posting-Host: 192.168.24.34 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: inmet2.burl.averstar.com 995319838 27019 192.168.24.34 (16 Jul 2001 21:43:58 GMT) X-Complaints-To: usenet@inmet2.burl.averstar.com NNTP-Posting-Date: 16 Jul 2001 21:43:58 GMT X-Mailer: Mozilla 4.75 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en Xref: archiver1.google.com comp.lang.ada:10028 Date: 2001-07-16T21:43:58+00:00 List-Id: Marin David Condic wrote: > > That is one possible way to go. However, what I have is a working parent > type that does useful things in its own right. It would be useful to have a > way of keeping it executable, but adding one or more operations that would > require extension. Basically, if you have a type that is a few generations > down the inheritance tree and now want to add some abstract operations, the > only way to do that is make the whole tree of types abstract. I'd prefer not > to do that. That's not true. Abstractness is *not* inherited. An abstract type can have a non-abstract parent, and vice-versa. So you could have a useful non-abstract "grandparent" type, an abstract immediate parent, and then a non-abstract child of this parent. Also remember that functions that return the type will automatically become abstract on inheritance, and thereby require overriding. > > Its the sort of thing where I've gone down a chain of inheritance and said > "O.K. Now I need the user to provide me with some functions and I don't want > to make this generic." I suppose I could use pointers to functions but I've > never liked that answer. > > A question I could get answered by the compiler, but maybe this is less > typing: Can I have an abstract tagged type that has data fields? My > recollection of examples I've seen have not had data - just null records. As someone else pointed out, abstract types can have as many components as you want. They can also have non-abstract operations. They can pretty much have everything a non- abstract type has (except for non-abstract functions that return the type). > > MDC > -- > Marin David Condic > Senior Software Engineer > Pace Micro Technology Americas www.pacemicro.com > Enabling the digital revolution > e-Mail: marin.condic@pacemicro.com > Web: http://www.mcondic.com/ > > "Ted Dennison" wrote in message > news:6b_27.15423$Kf3.181711@www.newsranger.com... > > In article <9ihnia$i8h$1@nh.pace.co.uk>, Marin David Condic says... > > > > > > > I believe you can have non-abstract primitive subprograms for abstract > types. > > What's wrong with doing that? -- -Tucker Taft stt@avercom.net http://www.avercom.net Chief Technology Officer, AverCom Corporation (A Titan Company) Bedford, MA USA (AverCom was formerly the Commercial Division of AverStar: http://www.averstar.com/~stt)