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,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news4.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread3.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Half Constrained Array Types and Slices Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Thu, 02 Mar 2006 05:00:06 GMT NNTP-Posting-Host: 67.150.71.1 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.pas.earthlink.net 1141275606 67.150.71.1 (Wed, 01 Mar 2006 21:00:06 PST) NNTP-Posting-Date: Wed, 01 Mar 2006 21:00:06 PST Xref: g2news1.google.com comp.lang.ada:3232 Date: 2006-03-02T05:00:06+00:00 List-Id: Robert Duff present a concept from his idea for an Ada-like language (not called Duff) some time ago, that there was no need for "box" ("<>") in his language: type String (Length : Natural) is array (1 .. Length) of Character; (IIRC) In Ada we have constrained and unconstrained array types; I call this a "half constrained" array type so we have names for all of them. Since his language doesn't have box, I presume an unconstrained array type would be: type Unconstrained (Lo : Positive; Hi : Natural) is array (Lo .. Hi) of Component; while a constrained type would look like an Ada constrained type: type Constrained is array (Lo .. Hi) of Component; I was wondering how slices would work with this kind of syntax. I would expect a slice of a half-constrained array to have the fixed lower bound specified in its type declaration; that would differ from the others. In Ada, we deal with slices of constrained array types by having the 1st named subtype be a constrained subtype of an unconstrained base type; that wouldn't seem to work here, since it would have a base type with 2 discriminants and a subtype with only 1. -- Jeff Carter "C's solution to this [variable-sized arrays] has real problems, and people who are complaining about safety definitely have a point." Dennis Ritchie 25