From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Inferring array index type from array object
Date: Wed, 23 Jun 2010 14:24:35 +0200
Date: 2010-06-23T14:24:36+02:00 [thread overview]
Message-ID: <4c21fd04$0$6769$9b4e6d93@newsspool3.arcor-online.net> (raw)
In-Reply-To: <hvsikv$3a7$1@news.eternal-september.org>
On 23.06.10 11:03, J-P. Rosen wrote:
>>> 2. Is it possible to declare the index variable without hardcoding the
>>> index type (that is, to infer it from the array object)?
>>
> There is no point in doing this, since the type of the array /is/
> hardcoded anyway. You could allow the same "simplification" as for
> loops, but as mentionned above, I prefer the other way round: always
> explicitely give the type name.
Is the required name somehow related to why the Ada.Container generics
do not re-export the formal types?
But anyway, without Dmitry's abstractions, a partial
solution should work along these lines, I think,
generic
type Index_Type is (<>);
type Component_Type is private;
package GA is
type Array_Type is array (Index_Type range <>) of Component_Type;
generic
with function "+" (Left, Right: Component_Type)
return Component_Type is <>;
Zero: in Component_Type;
package Algorithms is
function Sum (A: Array_Type) return Component_Type ;
end Algorithms;
end GA;
next prev parent reply other threads:[~2010-06-23 12:24 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-23 7:30 Inferring array index type from array object Maciej Sobczak
2010-06-23 8:01 ` Dmitry A. Kazakov
2010-06-23 9:03 ` J-P. Rosen
2010-06-23 12:24 ` Georg Bauhaus [this message]
2010-06-23 12:52 ` J-P. Rosen
2010-06-23 19:09 ` Simon Wright
2010-06-24 7:25 ` Georg Bauhaus
2010-06-23 14:38 ` Robert A Duff
2010-06-23 15:17 ` J-P. Rosen
2010-06-23 17:17 ` Robert A Duff
2010-06-24 6:16 ` J-P. Rosen
2010-06-23 12:13 ` Niklas Holsti
2010-06-23 14:27 ` Peter C. Chapin
2010-06-23 20:24 ` Niklas Holsti
2010-06-23 16:33 ` Warren
2010-06-23 17:49 ` Dmitry A. Kazakov
2010-06-23 18:45 ` Warren
2010-06-23 20:39 ` Niklas Holsti
2010-06-28 13:44 ` Warren
2010-06-28 22:18 ` Niklas Holsti
2010-06-29 1:49 ` Adam Beneschan
2010-06-29 2:10 ` (see below)
2010-06-29 16:56 ` Warren
2010-06-29 17:50 ` John B. Matthews
2010-06-29 19:31 ` Warren
2010-06-29 20:06 ` Jeffrey R. Carter
2010-06-29 20:16 ` Warren
2010-06-29 20:22 ` Adam Beneschan
2010-06-29 20:39 ` Dmitry A. Kazakov
2010-06-29 20:55 ` Warren
2010-06-29 21:00 ` Warren
2010-06-29 21:47 ` John B. Matthews
2010-06-29 21:52 ` Damien Carbonne
2010-06-29 22:22 ` Adam Beneschan
2010-06-30 16:43 ` Warren
2010-06-29 21:18 ` Jeffrey R. Carter
2010-06-30 5:01 ` Simon Wright
2010-06-30 14:29 ` Adam Beneschan
2010-06-29 20:28 ` Damien Carbonne
2010-06-29 21:20 ` John B. Matthews
2010-06-23 13:12 ` Gautier write-only
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox