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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.182.24.104 with SMTP id t8mr19165162obf.34.1400583118670; Tue, 20 May 2014 03:51:58 -0700 (PDT) X-Received: by 10.140.47.201 with SMTP id m67mr3934qga.29.1400583118567; Tue, 20 May 2014 03:51:58 -0700 (PDT) Path: border2.nntp.dca3.giganews.com!backlog4.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!c1no11165695igq.0!news-out.google.com!qf4ni5721igc.0!nntp.google.com!c1no11165692igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 20 May 2014 03:51:58 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=158.110.27.77; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99 NNTP-Posting-Host: 158.110.27.77 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: abstract types and subprograms From: mockturtle Injection-Date: Tue, 20 May 2014 10:51:58 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Original-Bytes: 2293 Xref: number.nntp.dca.giganews.com comp.lang.ada:186507 Date: 2014-05-20T03:51:58-07:00 List-Id: On Tuesday, May 20, 2014 12:22:30 PM UTC+2, Victor Porton wrote: >=20 >=20 > rdf-base.ads:20:04: function that returns abstract type must be abstract > gnatmake: "/home/porton/Projects/librdf-ada/rdf-base.adb" compilation err= or >=20 > By the philosophy of programming From_Handle should be non-abstract but= =20 > return an abstract object, and From_Handle should be automatically=20 > overridden for descendants non-abstract objects. >=20 In my opinion, there is a contradiction: an abstract type is, by definition= , a type "without objects," in the sense that you cannot have a value whose= type is an abstract type. Therefore, you cannot have a non-abstract func= tion that returns an abstract type, since by calling it you would create a = value of an abstract type. Functions that return abstract types make sense. For example, they can be = used to "force" who derives from you abstract type to provide a constructor= for the derived type. I use them, for example, to implement "plugins" in = order to have a standard constructor for the derived type. I hope this can help you a bit. Riccardo