comp.lang.ada
 help / color / mirror / Atom feed
From: BrianG <me@null.email>
Subject: Re: Array Help?
Date: Wed, 14 Mar 2012 22:55:27 -0400
Date: 2012-03-14T22:55:27-04:00	[thread overview]
Message-ID: <jjrln1$kp3$1@dont-email.me> (raw)
In-Reply-To: <Pine.LNX.4.64.1203090923440.19986@medsec1.medien.uni-weimar.de>

On 03/09/2012 03:48 AM, stefan-lucks@see-the.signature wrote:
> On Thu, 8 Mar 2012, Randy Brukardt wrote:
> [...]
>> <stefan-lucks@see-the.signature>  wrote:
>
>>> 1. Testing
>>>
>>> When you declare
>>>
>>>   procedure Sort(Items: in out array(Positive range<>) of T)
>>
>> Let's hope you never do that, because anonymous types are the bane of Ada.
>> And you surely can't do it today!
>
> OK, the real thing would look about like that:
>
>    generic
>       type Element_Type is (<>);
>       type Index_Type is (Positive range<>);
>       type Collection_Type is array(Index_Type range<>) of Element_Type;
>       with function "<"(Left, Right : Element_Type) return Boolean is<>;
>
>    function Sort(Items : Collection_Type) return Collection_Type;
>
>>> in a package specification, and you try to write a proper black-box test,
>>> you need *more* test cases then when you do the same with another popular
>>> language.
>>
>> Right. Bob's suggestion for some semi-constrained array subtype would fix
>> that. But note that it was killed in Ada 95 in part because the
>> implementation needed was essentially a record type with some sort of magic
>> indexing. Which was a mess.
>
> Would it ease the implementation if you constrain the start index to some
> fixed value, such as Index_Type'First?

If that's what you want, why can't you (in this case) define that in 
your generic parameters, rather than an index range (which already has a 
defined type)?

-- 
---
BrianG
000
@[Google's email domain]
.com



  parent reply	other threads:[~2012-03-15  2:55 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 20:15 Array Help? Will
2012-02-28 20:47 ` Ludovic Brenta
2012-02-28 22:11   ` Simon Wright
2012-02-28 23:09     ` Will
2012-02-29  0:24   ` Adam Beneschan
2012-02-28 20:50 ` Gautier write-only
2012-02-28 21:33 ` Simon Wright
2012-02-29  0:27   ` Adam Beneschan
2012-02-29  8:00     ` Simon Wright
2012-02-29  8:48       ` Simon Wright
2012-02-29  0:22 ` Adam Beneschan
2012-02-29 16:09   ` Robert A Duff
2012-02-29 16:50     ` Ludovic Brenta
2012-02-29 18:24       ` Robert A Duff
2012-02-29 19:45         ` stefan-lucks
2012-02-29 20:45           ` Jeffrey Carter
2012-02-29 21:27             ` stefan-lucks
2012-02-29 23:06           ` Robert A Duff
2012-03-02 13:45             ` stefan-lucks
2012-03-07 23:58             ` Randy Brukardt
2012-03-08 11:20               ` stefan-lucks
2012-03-09  2:02                 ` Randy Brukardt
2012-03-09  8:48                   ` stefan-lucks
2012-03-09 21:10                     ` Randy Brukardt
2012-03-15  2:55                     ` BrianG [this message]
2012-03-15  7:46                       ` stefan-lucks
2012-02-29 20:07         ` Dmitry A. Kazakov
2012-02-29 23:15           ` Robert A Duff
2012-03-01  8:54             ` Dmitry A. Kazakov
2012-03-01 14:06               ` Robert A Duff
2012-02-29 20:47         ` Simon Wright
2012-02-29 22:23           ` Robert A Duff
2012-02-29 23:27             ` Robert A Duff
2012-03-01  0:53               ` Adam Beneschan
2012-03-01  7:16               ` Ludovic Brenta
2012-03-01 14:03                 ` Robert A Duff
2012-03-08  0:11                   ` Randy Brukardt
2012-03-08  0:08               ` Randy Brukardt
2012-02-29 23:30             ` Simon Wright
2012-02-29 18:35     ` Jeffrey Carter
2012-02-29 22:59       ` Robert A Duff
2012-02-29 23:51         ` Jeffrey Carter
2012-03-01  3:03           ` Robert A Duff
2012-02-29 20:40     ` Adam Beneschan
replies disabled

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