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-Thread: 103376,1cb75f0476fe2d1a X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!p10g2000cwp.googlegroups.com!not-for-mail From: "Jeff Carter" Newsgroups: comp.lang.ada Subject: Re: Half Constrained Array Types and Slices Date: 6 Mar 2006 09:50:16 -0800 Organization: http://groups.google.com Message-ID: <1141667416.163432.304280@p10g2000cwp.googlegroups.com> References: NNTP-Posting-Host: 206.148.188.101 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1141667421 6476 127.0.0.1 (6 Mar 2006 17:50:21 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 6 Mar 2006 17:50:21 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8) Gecko/20050511,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: p10g2000cwp.googlegroups.com; posting-host=206.148.188.101; posting-account=CRM1hQ0AAADkQdMnGSPXFDwdgNRpoxjt Xref: g2news1.google.com comp.lang.ada:3276 Date: 2006-03-06T09:50:16-08:00 List-Id: Robert A Duff wrote: > > I don't know of any change between 83 and 95, here. > But I could be forgetting something; please remind me. I just checked my copy of the green book, and you're right. I seem to recall some problem with slices of constrained types in Ada 83, but I guess I'm mistaken. > I'd also be happy to eliminate slices as l-values. They cause a lot of > implementation difficulty for not much benefit. Or else go the whole > hog, and allow X(5..10) := "xx", which does not work in Ada, because > that would require changing the length of the whole thing. What would that do? > Yes, but this is all very not-Ada in several ways. > There are probably some semantic anomalies I have not considered. Of course, it's not-Ada by definition. But it's fun to talk about. I've been thinking about a language that allows null arrays, even for degenerate types like type Single is (One); type Degenerate is array (Single range <>) of Whatever; Suppose we could say something like V : Degenerate (null range); -- V'Length = 0 Now we can do things like for I in V'range loop -- loop is not entered if X in V'range -- always False Y : Degenerate (V'range); -- Y'Length = 0 More importantly, we do these kinds of things in subprograms with Degenerate parameters. If Degenerate is a string type, "" is meaningful. We seem to be fine as long as we don't do V'Last. I can't figure out how such a language should handle 'First and 'Last for such a value/object. Probably a failure of imagination on my part. -- Jeff Carter jrcarter commercial-at acm [period | full stop] org