comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: The "()" operator revisited.
Date: Wed, 14 Jan 2004 10:04:58 +0100
Date: 2004-01-14T10:04:58+01:00	[thread overview]
Message-ID: <820a00puecpmodp3vg43gpd7063rr5lj8q@4ax.com> (raw)
In-Reply-To: MfVMb.11867$Qq.262@nwrdny01.gnilink.net

On Tue, 13 Jan 2004 16:44:28 GMT, "Frank J. Lhota"
<NOSPAM.lhota.adarose@verizon.net> wrote:

>"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
>news:dmc700tmurmei4u19nof44803bv19f6d6o@4ax.com...
>> More specifically, how would it be matched against a formal
>> generic array parameter?
>
>That is far more ambitious than this proposal.

Ada is a language with great ambitions! (:-))

> The basic idea of this
>proposal is to allow array indexing notation for collections. For example,
>assume that we have a hash table that maps employee names to employee
>records. It would be nice if we could define "()" and "():=" for this hash
>table so that we could write something like this:
>
>    declare
>       Rec : Employee_Record_Hash_Table;
>    begin
>       ...
>       Rec( "Johnson" ) := This_Rec;
>       Display( The_Rec => Rec( "Smith" ) );
>       ...
>    end;

The problem is that without notion of abstract array as a class-wide
or generic parameter type, there will be no way to write
class-wide/generic subroutines taking advantage of indexing. Let I
have all containers of different kind having () indexing. This will
not help me. Because I will still be unable as little as just to write
a universal program searching max element in *a* container.

>To get something that could match a generic array parameter would require a
>lot of restrictions on abstract arrays, in particular that the indice types
>would have to be abstract discrete types.

No. We should simply go on and introduce abstract index type as a
counterpart of the formal discrete type:

type X is (<>);

One should be consequent. We need abstract discrete, integer, index,
numeric, string, array, access types. Have I forgot something? (:-))

> This would rule out abstract
>arrays such as what we see in this example.

I am not sure that hash table is an array. But if it should be (why
not) then, we should also distinguish two different kind of index
types:

1. Ordered, dense indices. Having ".." primitive operation and so
allowing iteration of arrays built upon them.

2. Unordered indices, with no [public] order defined (or used). An
array with an unordered index would be a hash table.

--
Regards,
Dmitry A. Kazakov
www.dmitry-kazakov.de



  parent reply	other threads:[~2004-01-14  9:04 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-12 17:53 The "()" operator revisited Frank J. Lhota
2004-01-12 18:38 ` Frank J. Lhota
2004-01-12 22:26 ` Robert A Duff
2004-01-13 16:29   ` Frank J. Lhota
2004-01-13  9:24 ` Dmitry A. Kazakov
2004-01-13 16:44   ` Frank J. Lhota
2004-01-13 17:13     ` Hyman Rosen
2004-01-13 22:27     ` Randy Brukardt
2004-01-14  2:30     ` Stephen Leake
2004-01-14  9:04     ` Dmitry A. Kazakov [this message]
2004-01-17  0:15       ` Kenneth Almquist
2004-01-17 21:15         ` Robert A Duff
2004-01-19 10:25         ` Dmitry A. Kazakov
2004-01-13 13:13 ` Marin David Condic
2004-01-13 17:38   ` Warren W. Gay VE3WWG
2004-01-13 19:09     ` Robert A Duff
2004-01-15 17:30       ` Warren W. Gay VE3WWG
2004-01-15 18:11         ` Robert A Duff
2004-01-15 19:36           ` tmoran
2004-01-15 20:35             ` Robert A Duff
2004-01-17  5:48               ` Robert I. Eachus
2004-01-16  1:52           ` Redefining := (was: The "()" operator revisited.) Jeffrey Carter
2004-01-16 21:37             ` Randy Brukardt
2004-01-19 11:33               ` Dmitry A. Kazakov
2004-01-16  3:11           ` The "()" operator revisited Mark A. Biggar
2004-01-16 13:28             ` Hyman Rosen
2004-01-16 16:19             ` Robert A Duff
2004-01-16 18:09             ` Warren W. Gay VE3WWG
2004-01-16 13:56           ` Frank J. Lhota
2004-01-16 16:14             ` Robert A Duff
2004-01-16 21:29               ` Frank J. Lhota
  -- strict thread matches above, loose matches on Subject: below --
2004-01-13 17:46 amado.alves
2004-01-13 22:21 ` Randy Brukardt
2004-01-13 17:53 amado.alves
2004-01-14  9:09 ` Dmitry A. Kazakov
2004-01-14 12:55   ` Georg Bauhaus
2004-01-14 15:05     ` Dmitry A. Kazakov
2004-01-15  1:21       ` Georg Bauhaus
2004-01-15  8:50         ` Dmitry A. Kazakov
2004-01-15 11:09           ` Georg Bauhaus
2004-01-15 13:23             ` Dmitry A. Kazakov
2004-01-17  6:26               ` Robert I. Eachus
2004-01-14 13:04   ` Hyman Rosen
2004-01-14 15:22 amado.alves
2004-01-14 16:16 ` Dmitry A. Kazakov
replies disabled

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