comp.lang.ada
 help / color / mirror / Atom feed
* Generic abstract procedures
@ 1999-10-14  0:00 Lutz Donnerhacke
  1999-10-14  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 6+ messages in thread
From: Lutz Donnerhacke @ 1999-10-14  0:00 UTC (permalink / raw)


Of course, RM 6-1(20) says:
    A subprogram_declaration or a generic_subprogram_declaration requires a
    completion: a body, a renaming_declaration (see 8.5), or a pragma Import
    (see B.1). A completion is not allowed for an
    abstract_subprogram_declaration.

Even RM 12-6(16) clarifies in Note (18):
    The actual subprogram cannot be abstract (see 3.9.3).

And so RM 3-9(11)
    A generic actual subprogram shall not be an abstract subprogram. ...

Does anybody knows a solution other than derivating the actual collection
from an abstract tagged type? Obviously I failed with a dumb generic attempt.
\f
But I love it.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Generic abstract procedures
  1999-10-14  0:00 Generic abstract procedures Lutz Donnerhacke
@ 1999-10-14  0:00 ` Matthew Heaney
  1999-10-14  0:00   ` Lutz Donnerhacke
  0 siblings, 1 reply; 6+ messages in thread
From: Matthew Heaney @ 1999-10-14  0:00 UTC (permalink / raw)


In article <slrn80biot.19p.lutz@taranis.iks-jena.de> , lutz@iks-jena.de 
(Lutz Donnerhacke) wrote:

> Does anybody knows a solution other than derivating the actual collection
> from an abstract tagged type? Obviously I failed with a dumb generic attempt.

What exactly are you trying to do?  It is certainly not obvious from
your post.

You must state your specific needs explicitly and unambigously, in order
for CLA readers to help you.

Matt

--
Science is, foremost, a method of interrogating reality: proposing
hypotheses that seem true and then testing them -- trying, almost
perversely, to negate them, elevating only the handful that survive to
the status of a theory. Creationism is a doctrine, whose adherents are
interested only in seeking out data that support it.

George Johnson, NY Times, 15 Aug 1999




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Generic abstract procedures
  1999-10-14  0:00 ` Matthew Heaney
@ 1999-10-14  0:00   ` Lutz Donnerhacke
  1999-10-14  0:00     ` Matthew Heaney
  0 siblings, 1 reply; 6+ messages in thread
From: Lutz Donnerhacke @ 1999-10-14  0:00 UTC (permalink / raw)


* Matthew Heaney wrote:
>(Lutz Donnerhacke) wrote:
>> Does anybody knows a solution other than derivating the actual collection
>> from an abstract tagged type? Obviously I failed with a dumb generic attempt.
>
>What exactly are you trying to do?  It is certainly not obvious from
>your post.

I'm going to implement a Iterator pattern.
A class like approach requires the following code:

  type My_Item_Type is new Item_Type with record
    item: Real_Item_Type;
  end record;
  
  type My_Collection_Type is new Collection_Type with record
    collection: Real_Collection_Type;
  end record;
  
  type My_Iterator(c: access My_Collection_Type) is
  new Iterator_Type(Collection_Type(c.all)'Access) with record
    state: ...;
  end record;

followed by some overloaded functions to catch all the abstract functions of
the type <SeeAbove>_Type is abstract tagged limited null record;

The generic approach is able to provide a much simpler interface. I have to
test how a generic package can be used to generate the Types above.

My question is: Does anybody already solved such a problem in an elegant way?
  




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Generic abstract procedures
  1999-10-14  0:00   ` Lutz Donnerhacke
@ 1999-10-14  0:00     ` Matthew Heaney
  1999-10-14  0:00       ` Matthew Heaney
  1999-10-15  0:00       ` Lutz Donnerhacke
  0 siblings, 2 replies; 6+ messages in thread
From: Matthew Heaney @ 1999-10-14  0:00 UTC (permalink / raw)


In article <slrn80cetb.mmj.lutz@belenus.iks-jena.de> , lutz@iks-jena.de 
(Lutz Donnerhacke) wrote:


> I'm going to implement a Iterator pattern.
[snip]
> My question is: Does anybody already solved such a problem in an elegant way?

See my article "Iterator and Factory Method Patterns Combined," in the
Nov 1998 design patterns archive, for some ideas.

Matt

--
Why stop at evolution and cosmology, though? Let's make sure that the
schoolkids of Kansas get a really first-rate education by loosening up
the teaching standards for other so-called scientific ideas that are,
after all, just theories. The atomic theory, for example. The theory of
relativity. Heck, the Copernican theory--do we really know that the
universe doesn't revolve around the earth?

John Rennie, Scientific American, Oct 1999




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Generic abstract procedures
  1999-10-14  0:00     ` Matthew Heaney
@ 1999-10-14  0:00       ` Matthew Heaney
  1999-10-15  0:00       ` Lutz Donnerhacke
  1 sibling, 0 replies; 6+ messages in thread
From: Matthew Heaney @ 1999-10-14  0:00 UTC (permalink / raw)


In article <380685f5_4@news1.prserv.net> , "Matthew Heaney" 
<matthew_heaney@acm.org> wrote:

> In article <slrn80cetb.mmj.lutz@belenus.iks-jena.de> , lutz@iks-jena.de
> (Lutz Donnerhacke) wrote:
>
>
>> I'm going to implement a Iterator pattern.
> [snip]
>> My question is: Does anybody already solved such a problem in an elegant way?
>
> See my article "Iterator and Factory Method Patterns Combined," in the
> Nov 1998 design patterns archive, for some ideas.

Oops!  I forgot to provide a URL:

<http://www.acm.org/archives/patterns.html>


Matt

--
Evolution is as well documented as any phenomenon in science, as
strongly as the earth's revolution around the sun rather than vice
versa.

Stephen Jay Gould, Time, 23 Aug 1999




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Generic abstract procedures
  1999-10-14  0:00     ` Matthew Heaney
  1999-10-14  0:00       ` Matthew Heaney
@ 1999-10-15  0:00       ` Lutz Donnerhacke
  1 sibling, 0 replies; 6+ messages in thread
From: Lutz Donnerhacke @ 1999-10-15  0:00 UTC (permalink / raw)


* Matthew Heaney wrote:
>(Lutz Donnerhacke) wrote:
>> I'm going to implement a Iterator pattern.
>[snip]
>> My question is: Does anybody already solved such a problem in an elegant way?
>
>See my article "Iterator and Factory Method Patterns Combined," in the
>Nov 1998 design patterns archive, for some ideas.

Of course I read it before trying anything to implement. Many thanx.
The large article about multiple inheritance in this group yesterday
is wonderful. A lot of ideas.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-10-15  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-14  0:00 Generic abstract procedures Lutz Donnerhacke
1999-10-14  0:00 ` Matthew Heaney
1999-10-14  0:00   ` Lutz Donnerhacke
1999-10-14  0:00     ` Matthew Heaney
1999-10-14  0:00       ` Matthew Heaney
1999-10-15  0:00       ` Lutz Donnerhacke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox