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,fa18fb47ddd229a7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-11 07:09:40 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!news-out1.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!ptdnetS!newsgate.ptd.net!newsfeed.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Proposed change to BC iterator parameters Date: 11 Dec 2003 10:09:39 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: pip1-5.std.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1071155379 1452 192.74.137.185 (11 Dec 2003 15:09:39 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 11 Dec 2003 15:09:39 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:3369 Date: 2003-12-11T10:09:39-05:00 List-Id: Jeffrey Carter writes: > If we had a syntax like that I described, there would be no predefined > "=" for either kind of type. Then how do you write the body of the user-defined "="? > One can think about all kinds of constraints on types, such as the > integer types you mentioned. It would be nice to have unconstrained > arrays with a fixed lower bound*: > > type String_From_1 is array (Positive range 1 .. <>) of Character; Indeed. I think the way to do that would be to eliminate the "range <>" syntax, and allow arrays types to have discriminants. So the index subtype would be given as a name, or a "name range expression..expression", where either expression can refer to a discrimant. Like this: type String(Last: Natural) is array (Positive range 1 .. Last) of Character; Instead of X'Last, one would say X.Last. This seems simpler than having special syntax "range <>", and then extending that to "range 1..<>" and "range <>..10". Something like that was proposed during the Ada 9X project. > I don't expect to see major changes of this sort. No, I don't expect that particular change in the next Ada. >... Where do you stop? You don't, I suppose. Fortran is much older than Ada, and they keep coming out with major revisions of Fortran. > Should you allow arrays with a fixed upper bound? Of course. To disallow that would be an arbitrary restriction, not a simplification (presuming you're going to allow fixed lower bounds). > * Ada sort of has this: > > type String_From_1 (Length : Natural) is record > Value : String (1 .. Length); > end record; Sort of. The syntax for string literals and slices becomes pretty awful. - Bob