comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Array Help?
Date: Thu, 1 Mar 2012 09:54:46 +0100
Date: 2012-03-01T09:54:46+01:00	[thread overview]
Message-ID: <123dqk23rvyf0$.iuh8anhb1hl7.dlg@40tude.net> (raw)
In-Reply-To: wccty29s02f.fsf@shell01.TheWorld.com

On Wed, 29 Feb 2012 18:15:52 -0500, Robert A Duff wrote:

> Ada allows you to fix 'First and 'Last, and it allows you to let
> both vary.  What's missing is a way to fix 'First, but allow
> 'Last to vary.  I sort of implied that a predicate should do that,
> but that's wrong.  There should be SOME way to do it.  And for
> completeness, I'd allow fixing 'Last, but allowing 'First to vary,
> although that's much less useful.

That sort of thing has nothing to do with constraining, so the idea to get
it using a predicate is straight wrong.

> I'm certainly not saying "all arrays should start at 1".  I'm saying
> "there should a way to declare an array type such that all objects of
> that type start at 1 (or any other value) while allowing 'Last to
> vary".

The array abstraction is that the given index denotes the *same* array
element. Sliding indices is another abstraction (ordinal, sequence) and it
does not require arrays having separate index types. Ordinals are same for
all sequences.

The point is that all cases where you wanted arrays to start from some
element are actually views on an array as a sequence of elements. Provide
that view and the problem would vanish. This would also eliminate the
problem of constructing empty arrays and simplify generics dealing with
arrays.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2012-03-01  8: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
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 [this message]
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