comp.lang.ada
 help / color / mirror / Atom feed
From: brashear@ns1.sw-eng.falls-church.va.us (Philip Brashear)
Subject: Re: parameterless generics?
Date: 1996/07/12
Date: 1996-07-12T00:00:00+00:00	[thread overview]
Message-ID: <4s5cnp$gq2@ns1.sw-eng.falls-church.va.us> (raw)
In-Reply-To: 4s48k9$3be$1@mhafn.production.compuserve.com


In article <4s48k9$3be$1@mhafn.production.compuserve.com>,
Brian Gilbert  <71413.1453@CompuServe.COM> wrote:
>Does anybody have a reason to use a generic (package or 
>subprogram) without a parameter?  The language (Ada 83 at least) 
>seems to allow it, but everytime the generic is instantiated it 
>would produce an identical copy.  Comments?
>
>Brian Gilbert
>71413.1453@compuserve.com



Sure:

I've used a generic package to represent ONE OBJECT of an Abstract Data
Type (say Stack).  [But I also think that it would have been better to
use a generic type parameter so that I could have made stacks of XX.]

The idea is that the basic structure (the stack body) is in the package
body.  If your instantiation is called My_Stack, then you write calls
like "My_Stack.Push (Thing);", "if My_Stack.Is_Empty then", etc.  Some
people feel more comfortable with such syntax.

Anywho, it's an example.

Phil Brashear




  parent reply	other threads:[~1996-07-12  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-12  0:00 parameterless generics? Brian Gilbert
1996-07-11  0:00 ` Laurent Guerby
1996-07-11  0:00 ` Ray Blaak
1996-07-15  0:00   ` Mark A Biggar
1996-07-12  0:00 ` Philip Brashear [this message]
1996-07-12  0:00 ` Robert Dewar
1996-07-22  0:00   ` Mats Weber
1996-07-12  0:00 ` Theodore E. Dennison
1996-07-14  0:00 ` Norman H. Cohen
1996-07-15  0:00 ` Chris Papademetrious
1996-07-17  0:00   ` Richard Riehle
1996-07-18  0:00 ` Martin Lorentzon
replies disabled

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