comp.lang.ada
 help / color / mirror / Atom feed
From: "Ehud Lamm" <mslamm@mscc.huji.ac.il>
Subject: Re: Generic Packages
Date: Thu, 19 Apr 2001 23:26:25 +0300
Date: 2001-04-19T23:26:25+03:00	[thread overview]
Message-ID: <9bni0i$ugu$1@news.huji.ac.il> (raw)
In-Reply-To: 9bnh7f$5di$1@news.inter.net.il

First thing you have to realize is that when you want a generic unit to work
ona private or limited private type, the package must somehow be told how to
work with objects of the opaque type.

Basically, you do this by supplying routines as generic parameters. These
routines are the ones that know how to use the type (they usually come from
the package that exports the time). They, in essence, provide an interface
that the generic unit needs in order to work with the type. This is a
restricted form of the itnerface exported by the ADT package.

I usually describe this situation with the following metahpor.There is a
secrect, and this secret is how to handle the abstract data type. You want
to pass this secret to the generic unit. However generic units don't have
ears so you can't just lean over and whisper the secret. What you do is
package the secret inside a routine (a more techincal term would be
"procedural abstraction") and pass the routine to the generic unit.

This subject is explained very well in the Ada83 Ratioanale chapter on
generic units. I highly recommend reading it (you instructor should have a
copy of this chapter, and you can also find it online).

Good luck with the assignment!

Ehud Lamm





  reply	other threads:[~2001-04-19 20:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-19 21:27 Generic Packages Eyal Ben-gal
2001-04-19 20:26 ` Ehud Lamm [this message]
2001-04-19 22:09 ` Robert A Duff
2001-04-20  6:50   ` Ehud Lamm
  -- strict thread matches above, loose matches on Subject: below --
2002-07-09 13:03 generic packages Sami Evangelista
2002-07-09 13:28 ` Fabien Garcia
2002-07-09 13:41   ` Sami Evangelista
2002-07-10  2:00 ` SteveD
2002-07-11 13:41   ` Sami Evangelista
2002-07-11 20:56     ` Adam Beneschan
2000-02-16  0:00 Generic packages David Olsson
2000-02-16  0:00 ` R. Tim Coslet
1998-08-10  0:00 Generic Packages Tory Patnoe
1998-08-11  0:00 ` Tucker Taft
1998-08-11  0:00 ` Robert I. Eachus
1998-08-12  0:00 ` Dale Stanbrough
1998-08-17  0:00 ` Dr. Hubert B. Keller
1998-08-27  0:00   ` Simon Wright
     [not found] <5e03nm$esq@netty.york.ac.uk>
1997-02-15  0:00 ` Jon S Anthony
1997-02-20  0:00 ` phtruong
1997-02-21  0:00   ` Robert Dewar
1997-02-25  0:00     ` Quorlia
1997-02-27  0:00       ` Robert Dewar
     [not found] <4inq3c$lr9@NNTP.MsState.Edu>
1996-03-22  0:00 ` John Herro
1996-03-22  0:00   ` Samuel Tardieu
replies disabled

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