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,3eec69188f5bf88a,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news3.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: Extended Type Statements Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Tue, 17 Jan 2006 18:04:03 GMT NNTP-Posting-Host: 67.3.220.1 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.pas.earthlink.net 1137521043 67.3.220.1 (Tue, 17 Jan 2006 10:04:03 PST) NNTP-Posting-Date: Tue, 17 Jan 2006 10:04:03 PST Xref: g2news1.google.com comp.lang.ada:2513 Date: 2006-01-17T18:04:03+00:00 List-Id: A type defines a set of values and a set of operations on those values. That's the definition I learned, and is similar to the one in ARM 3.2. In Ada, some type declaration statements define at type, while others don't. For example type I is range 1 .. 10; declares a set of values (1 .. 10) and a set of operations on those values ("+", "-", and so on), while type T is limited private; declares no values and very few operations. Instead, it's the entire package spec that T is in that defines the type: package P_For_T is type T is limited private; C : constant T; procedure Put (Into : in out T; Value : in Integer); function Get (From : T) return Integer; private -- P_For_T ... end P_For_T; I was wondering if it might be a good idea for a language (probably not Ada) to have an extended type statement that covers both concepts with a single statement. So an integer type could be declared as something like type I is values => range 1 .. 10; end I; and an ADT as type T is values => C : constant; operations => limited => True; procedure Put (Into : in out T; Value : in Integer); function Get (From : T) return Integer; implementation => private; end T; There could be sections in the statement for representation clauses and the like. Any comments? Would this sort of thing have any value? -- Jeff Carter "I'm a kike, a yid, a heebie, a hook nose! I'm Kosher, Mum! I'm a Red Sea pedestrian, and proud of it!" Monty Python's Life of Brian 77