From: lutz@iks-jena.de (Lutz Donnerhacke)
Subject: Re: Generic abstracts
Date: 1999/11/29
Date: 1999-11-29T00:00:00+00:00 [thread overview]
Message-ID: <slrn845ifq.18l.lutz@taranis.iks-jena.de> (raw)
In-Reply-To: 3842BFFB.70B08603@averstar.com
* 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/
next prev parent reply other threads:[~1999-11-29 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-11-25 0:00 Generic abstracts Lutz Donnerhacke
1999-11-25 0:00 ` Lutz Donnerhacke
1999-11-29 0:00 ` Tucker Taft
1999-11-29 0:00 ` Lutz Donnerhacke [this message]
1999-11-29 0:00 ` Tucker Taft
1999-11-30 0:00 ` Robert A Duff
1999-11-30 0:00 ` Tucker Taft
1999-11-30 0:00 ` Lutz Donnerhacke
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox