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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,db88d0444fafe8eb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsfeed.gamma.ru!Gamma.RU!npeer.de.kpn-eurorings.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Arrays indexed by fixed point types (Was: Surprise in array concatenation) Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1125544603.561847.32140@g47g2000cwa.googlegroups.com> <1125610942.747981.280770@f14g2000cwb.googlegroups.com> <1x7uhgunzbhct.xbqo7v5cc5o7$.dlg@40tude.net> Date: Mon, 5 Sep 2005 17:10:17 +0200 Message-ID: <1to3vs88qobxs$.1x5vxxh0omir9.dlg@40tude.net> NNTP-Posting-Date: 05 Sep 2005 17:10:18 MEST NNTP-Posting-Host: 368f2849.newsread2.arcor-online.net X-Trace: DXC=CHhH<22m]R[gQ;OFXR3=FUQ5U85hF6f;TjW\KbG]kaMXQ>n?D9BSA]\F8R>5X@G[JRWRXZ37ga[7Zn919Q4_`VjYB8=X\UUgbkT X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:4442 Date: 2005-09-05T17:10:18+02:00 List-Id: On 05 Sep 2005 15:07:38 +0200, Jacob Sparre Andersen wrote: >> I think that instead of blowing up the language with countless types >> which might be useful as array indices (actually maps), it would be >> much better to provide user-defined index and array types with >> primitive operations "()", 'First, 'Range, "in", "not in", aggregate >> etc. > > That would be nice, but wouldn't it be rather difficult to fit into > Ada? We would still have the limitation as to which index types could > be used together with a for loop, so there would also be a need for > some kind of iterator for the user-defined array types. Yes. That should be the user-defined "index" type, where "index" would be a class of types like "array", "access", "range" are. The main problem with making "array" and "access" fully user-defined is IMO maintaining parallel type hierarchies: abstract access <-- user access abstract aliased type <-- concrete target type --------- abstract array <-- user array [+ slices and other related subarray types] abstract index <- user index [+ ranges and other subsets of] abstract element type <-- concrete element type To organize a for loop one should be able to obtain the index type of the array. We already have T'Class, we could also introduce T'Index, T'Element etc. It smells of types as first-class objects, matched by structure. Not very Ada. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de