comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: generics and records
Date: Mon, 28 Feb 2005 06:02:32 GMT
Date: 2005-02-28T06:02:32+00:00	[thread overview]
Message-ID: <YtyUd.7631$873.435@newsread3.news.pas.earthlink.net> (raw)
In-Reply-To: <1109532840.857126.234720@z14g2000cwz.googlegroups.com>

spambox@volja.net wrote:

> in the process of learning Ada, I came to the problem of generics and
> records. I want to instantiate a package with a record type:
> 
> generic
>  type x is private;
> package ...
> private
>  type xx is new x;
> end ...
> 
> When I want to use it:
> 
> type myrecord is
>  ...
> package somename is new seeabove(myrecord);
> 
> I don't know if this is the correct way. The problem is, how do I make
> a component of myrecord available to the package?

The formal part of a generic specifies what the generic needs in order 
to provide its services to its clients. If the generic needs to know 
about the specific components of a specific record type, then it is 
probably too tightly bound to the concept of that record type for it to 
be a formal parameter of the generic.

-- 
Jeff Carter
"Have you gone berserk? Can't you see that that man is a ni?"
Blazing Saddles
38



  parent reply	other threads:[~2005-02-28  6:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-27 19:34 generics and records spambox
2005-02-27 20:16 ` Dmitry A. Kazakov
2005-02-27 21:31   ` spambox
2005-02-28  8:47     ` Dmitry A. Kazakov
2005-02-28  9:00       ` spambox
2005-02-28 10:07         ` Dmitry A. Kazakov
2005-02-28  6:02 ` Jeffrey Carter [this message]
2005-03-01 11:21 ` Martin Krischik
2005-03-01 19:47   ` Georg Bauhaus
2005-03-01 20:17     ` Dmitry A. Kazakov
replies disabled

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