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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.unit0.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 30 Jun 2014 11:29:57 +0200 From: "G.B." User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Function definitions - with clarification References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <53b12e15$0$6610$9b4e6d93@newsspool4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 30 Jun 2014 11:29:57 CEST NNTP-Posting-Host: 5eecb99d.newsspool4.arcor-online.net X-Trace: DXC=0ga_^mb<_1Cj7E:bke<5HF4IUKJLh>_cHTX3jMYk05VIM3hOH X-Complaints-To: usenet-abuse@arcor.de Xref: news.eternal-september.org comp.lang.ada:20644 Date: 2014-06-30T11:29:57+02:00 List-Id: On 29.06.14 21:20, montgrimpulo wrote: > V : vi := new Individual (P=>P1,Q=>Q1,R=>R1); > type population is array (1 .. Popsize) of vi; Regarding resource management, I'd now consider, e.g., deriving type Individual from Finalization.Controlled. By overriding the primitive operation Finalize you could then have the memory of V deallocated automatically, when EA exits. Since for vi, its type Individual is constrained in EA, and if the sizes of the component arrays of Inidividual are never so large as to approach (implementation defined) Natural'Last, then type Population, defined in EA, could be an array of this constrained subtype of Individual. This will save memory management. If knowledge of cardinalities is reflected in types of the program, rather than simply using Positive etc, then more control and more clarity of intent is added to the program, I think. It adds "categorizing" the numbers according to purpose. You could still depend on Positive, if needed: type κ is new Positive [range ...]; where κ expresses the intent of using a range of positive integers.