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,c4a14ea3a6faca74 X-Google-Attributes: gid103376,public From: lutz@iks-jena.de (Lutz Donnerhacke) Subject: Re: Generic abstracts Date: 1999/11/29 Message-ID: #1/1 X-Deja-AN: 554523515 Distribution: world Content-Transfer-Encoding: 8bit References: <3842BFFB.70B08603@averstar.com> Content-Type: text/plain; charset=ISO-8859-1 Organization: IKS GmbH Jena Mime-Version: 1.0 User-Agent: slrn/0.9.5.7 (UNIX) Newsgroups: comp.lang.ada Date: 1999-11-29T00:00:00+00:00 List-Id: * Tucker Taft wrote: >Lutz Donnerhacke wrote: >> The abstract definition should be used to ensure a consistent >> interface. I have two problems: >> - A generic procedure which can be missed on implementation. >> Raising an exception might be acceptable. >> - It is not possible to predefine a body for a generic function. >> No return value is available. >> Raising an exception does not stop the compiler from requiring >> a return value. > >I'm unclear as to what you are trying to accomplish by including >generic subprograms that are abstract. Generic subprograms are >not inherited, so there is no point in declaring them on an >abstract type. with Abstract_Lists; generic type Item (<>) is abstract tagged limited private; package Concrete_Lists is package Abstract_Template is new Abstract_Lists (Item => Item); type List is new Abstract_Template.List with private; type List_Item is new Abstract_Template.List_Item with private; type List_Iterator is new Abstract_Template.List_Iterator with private; -- now the compiler requires to implement all abstract functions -- including the generic Iterate and Delete procedures function Is_Empty (L : List) return Boolean; generic with procedure On_Item (E : in out Item); procedure For_Each (L : in List); ... end Concrete_Lists; An solution without (abtract) interfaces can be obtained from ftp.iks-jena.de:/pub/mitarb/lutz/ada/types/