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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 Path: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Ada design bug or GNAT bug? Date: Sat, 4 Jul 2015 19:48:35 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <4lrj5zz2u2z.u8x9cf7xzic6.dlg@40tude.net> <58f64fa9-7d0b-44dd-870c-77d9afcb82c4@googlegroups.com> <4228c0ea-837d-42a0-b2a8-a98d8d30f820@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1436057316 31908 24.196.82.226 (5 Jul 2015 00:48:36 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sun, 5 Jul 2015 00:48:36 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: number.nntp.giganews.com comp.lang.ada:193923 Date: 2015-07-04T19:48:35-05:00 List-Id: "Björn Lundin" wrote in message news:mn8hok$fdf$1@dont-email.me... > On 2015-07-04 09:46, Simon Wright wrote: >> Shark8 writes: >> >>> Also, I seem to recall your dislike of INTERFACEs -- in hindsight, >>> what would you have done differently if you needed the mechanism of >>> "Type T has functions X, Y, and X" applied to a group of types? >>> Generics, or some variations thereof? >> >> Generic signature packages? >> > > I had this problem when implementing another companies proprietary > communications protocol, that we needed to communicate with. > The physical devices were picking-robots. > All messages had a common headers and then message specific fields. > And they had to have certain functions. To_String, Save_to_Database, > Send, etc. > > Since I had complete control over the implementation, I > ended up using inheritance from an abstract type. > > Some functions of the abstract type were implemented, > and others - to specialized for the inherited type - > was declared abstract. Right, with single inheritance. Good enough for 98% of problems, IMHO. I've used abstract types this way (in Claw and in Claw tools), but I found that the main gain was the shared implementations that could be provided by the abstract type. Interfaces don't allow them, so they provide cool-looking, but mainly useless capabilities. Randy.