From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,88b676af04f3073d X-Google-Attributes: gid103376,public From: Brian Rogoff Subject: Re: Ada generics are bad Date: 1998/04/10 Message-ID: #1/1 X-Deja-AN: 342912766 References: <6gm6jc$fbp@newshub.atmnet.net> Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: 892250776 5802 bpr 206.184.139.132 Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-04-10T00:00:00+00:00 List-Id: On 10 Apr 1998, Christopher Green wrote: > In article , Glenden Lee 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 > >