comp.lang.ada
 help / color / mirror / Atom feed
From: "G.B." <rm-dash-bau-haus@dash.futureapps.de>
Subject: Re: Function definitions - with clarification
Date: Mon, 30 Jun 2014 11:29:57 +0200
Date: 2014-06-30T11:29:57+02:00	[thread overview]
Message-ID: <53b12e15$0$6610$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <a87900f0-5afa-47a4-93e2-83222fc667e0@googlegroups.com>

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.

  reply	other threads:[~2014-06-30  9:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-22 11:34 Function definitions - with clarification montgrimpulo
2014-06-22 12:04 ` Simon Clubley
2014-06-22 14:25 ` montgrimpulo
2014-06-22 15:30 ` Georg Bauhaus
2014-06-22 17:29 ` montgrimpulo
2014-06-22 17:45 ` Shark8
2014-06-22 18:03   ` montgrimpulo
2014-06-22 18:45     ` Simon Clubley
2014-06-22 19:28       ` montgrimpulo
2014-06-22 21:04         ` Simon Wright
2014-06-22 21:17       ` Jeffrey Carter
2014-06-22 19:55     ` Shark8
2014-06-23 16:26 ` Adam Beneschan
2014-06-29 15:31 ` cotswold
2014-06-29 19:20 ` montgrimpulo
2014-06-30  9:29   ` G.B. [this message]
2014-06-30 17:55     ` Shark8
2014-07-01  8:58       ` Georg Bauhaus
2014-07-04  6:45         ` J-P. Rosen
2014-06-30 13:23 ` montgrimpulo
replies disabled

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