From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b5ab7c96b188b59e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-14 00:58:15 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!tar-atanamir.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: The "()" operator revisited. Date: Wed, 14 Jan 2004 10:04:58 +0100 Message-ID: <820a00puecpmodp3vg43gpd7063rr5lj8q@4ax.com> References: NNTP-Posting-Host: tar-atanamir.cbb-automation.de (212.79.194.116) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de 1074070694 13356442 212.79.194.116 ([77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:4385 Date: 2004-01-14T10:04:58+01:00 List-Id: On Tue, 13 Jan 2004 16:44:28 GMT, "Frank J. Lhota" wrote: >"Dmitry A. Kazakov" 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