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,37680a99b5e22b2b X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Shared Generic Instance Code Date: 1997/04/03 Message-ID: #1/1 X-Deja-AN: 230562042 References: <5hrkhkINN9ip@snoopy.cis.ohio-state.edu> <1997Apr1.201631.28634@ocsystems.com> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-04-03T00:00:00+00:00 List-Id: iBill Keen said <> Robert replies: Sorry, I don't get the point. Yes, GNAT can handle this case. No, there is no special complexity in handling this case (note that the base type of T, which is what of course is significant, is always Integer). Shared code would add a LOT of complexity. Consider for example a generic formal type "digits <>". Now this code must handle all possible lengths of floating-point. This is easy if you have only one length (that's what the Rational compiler used to do), or if you do everything in the longest type, and don't worry too much that you are cheating on operatoins like Unchecked_Conversion (that's what RR used to do), but to do it right with multiple fpt precisions, and not introduce a big efficiency penalty -- that's hard, and close to impossible, respectively! Obviously any Ada compiler would be happy to share certain instantiations. For examle, if we instantiate Integer_IO three times all for type Integer, tha's probably pretty easy to share! However, even the mechanism to sometimes share in the simple cases introduces a lot of complexity. In fact as Bob pointed out, the sometimes share solution is probably harder than either of the "pure" solutions.