comp.lang.ada
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@shell5.ba.best.com>
Subject: Re: Ada generics are bad
Date: 1998/04/10
Date: 1998-04-10T00:00:00+00:00	[thread overview]
Message-ID: <Pine.BSF.3.96.980410160845.29525A-100000@shell5.ba.best.com> (raw)
In-Reply-To: 6gm6jc$fbp@newshub.atmnet.net


On 10 Apr 1998, Christopher Green wrote:
> In article <Er3npt.4sK@array.ca>, Glenden Lee <glee@array.ca> wrote:
> > ... complaints about generics leading to recompilation snipped ...
> 
> Some compilers (Apex is one) have an option for "function form" generics.
> This allows the generic body to be compiled once and reused for each
> instance of the generic.  Function form generics are often not quite as
> efficient in code speed (because they can't be inlined), and there are
> a few cases in which they can't be used at all.

I think this can be phrased very simply, at the risk of some
oversimplification. Generics which share code rely on some level of 
uniform representation, and hence pointers/access-types. This indirection 
allows one to get away with fewer recompiles. The same issue arises
without generics if you look at the representation information in the 
private section of a package spec. If the size of some data type changes
there than you have to recompile dependent packages. If you use the 
trick of making all datatypes pointers to things in the body, than you
shouldn't have to recompile. 

Ada compilers typically implement generics by macro expanding, ML
is typically like Lisp in that everything is a poinetr "under the hood".
Each has its advantages and disadvantages. One could argue that the 
method of implementation should be specified; I tend to write Ada as 
though macro expansion of generics is a given.

-- Brian

> With "function form" generics, updating and recompiling the generic body
> does not obsolete units that instantiate it or depend on instantiations,
> and it is possible to deliver libraries that include only object code
> for such bodies (this is a key concern for developers of commercial Ada
> software such as ourselves, who are wary of releasing more source code
> than we absolutely have to).
> -- 
> Chris Green                                  Email cgreen@atc.com
> Advanced Technology Center                   Phone (714) 583-9119
> 22982 Mill Creek Drive                                   ext. 220
> Laguna Hills, CA 92653                       Fax   (714) 583-9213
> 
> 





  reply	other threads:[~1998-04-10  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-08  0:00 Ada generics are bad Glenden Lee
1998-04-08  0:00 ` Tucker Taft
1998-04-09  0:00 ` Anonymous
1998-04-10  0:00 ` Christopher Green
1998-04-10  0:00   ` Brian Rogoff [this message]
1998-04-11  0:00   ` Robert Dewar
1998-04-13  0:00     ` Christopher Green
1998-04-13  0:00       ` Matthew Heaney
1998-04-13  0:00         ` Christopher Green
1998-04-13  0:00         ` nabbasi
1998-04-13  0:00           ` future of proprietry source code (was: Ada generics are bad) Fergus Henderson
1998-04-14  0:00             ` David Masterson
1998-04-16  0:00               ` David Kastrup
1998-04-16  0:00                 ` David Masterson
1998-04-17  0:00                   ` David Kastrup
1998-04-17  0:00               ` campo
1998-04-16  0:00             ` Tim Smith
1998-04-17  0:00               ` Thomas Bushnell, n/BSG
1998-04-18  0:00                 ` Bill Gribble
1998-04-20  0:00                   ` Ole-Hjalmar Kristensen
1998-04-21  0:00             ` William Tanksley
1998-04-14  0:00         ` Ada generics are bad Robert Munck
1998-04-14  0:00           ` Matthew Heaney
1998-04-15  0:00           ` Jonathan Guthrie
1998-04-14  0:00         ` Al Christians
replies disabled

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