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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.140.19.4 with SMTP id 4mr3425754qgg.29.1458775516451; Wed, 23 Mar 2016 16:25:16 -0700 (PDT) X-Received: by 10.157.35.14 with SMTP id j14mr63563otb.8.1458775516283; Wed, 23 Mar 2016 16:25:16 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!feeder2.usenet.farm!feeder.erje.net!2.us.feeder.erje.net!news.glorb.com!b101no5141qga.1!news-out.google.com!u9ni4671igk.0!nntp.google.com!nt3no3967581igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 23 Mar 2016 16:25:16 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8201:bb5a:5985:2c17:9409:aa9c; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8201:bb5a:5985:2c17:9409:aa9c References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <60331fea-1993-45eb-8459-b154c621a106@googlegroups.com> Subject: Re: Too big From: rieachus@comcast.net Injection-Date: Wed, 23 Mar 2016 23:25:16 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:29859 Date: 2016-03-23T16:25:16-07:00 List-Id: =20 > What is the most likely reason? For example, the offending subunit contai= ns a large number of "separate" procedures. Would it help to wrap them up i= n a package? ther than heuristic methods >=20 > All sensible suggestions welcom GNAT tends to insert separate units where they belong during compilation. = In other words, separate may be of use to you in organizing your program co= de, but the compiler never actually sees the unit as separate. However, if you reuse separate unit names, when the compiler tries to merge= the text, you can end up with an infinitely long source file. Sounds like= what is happening to you. If you just cut and paste to remove separate units until it works, fine. H= owever, I suspect that you have a more subtle problem in that you are using= separate units where you really should be using generics. There is a sort= of "Aha!" moment when you realize that generic instantiation in theory hap= pens at execution time. (In other words, the generic is instantiated--the = formal generic parameters are replaced by the actual (generic) parameters, = then the code is called as usual. Ada always goes through this two-step at = execution time. Most of the time one or the other--elaboration or calling-= -does most of the work, but they are always both done and in order.) The co= mpiler may make several different code objects (at compile time) for a gene= ric unit, and in some cases the correct unit will be selected during execut= ion. Sounds complex, but it really isn't. A short example should help: generic type Element is private; type My_Array is array (Integer) of Element; function Reverse(MA: My_Array) is Temp: My_Array :=3D MA; for I in 1..MA'length loop -- The array bounds here might be say, 11..19. Temp(MA'last-I+1) :=3D MA(I); end loop; return Temp; end Reverse; When you say: function Reverse_String is new Reverse(Character, String); you get a regular function. Junk: String :=3D Reverse(Some_string); Is th= en a normal call. Why all this fancy stuff? The two stages can be a natural separation of ro= les, and saves you from creating (sometimes) hundreds of busy little operat= ions which you have to keep straight. I suspect that this gives you the (s= ource) readability you were trying to get with separate. I think I got all that right.