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,49c69fcb0de2bb74 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-08-28 23:06:56 PST Path: supernews.google.com!sn-xit-02!sn-east!supernews.com!newscon01.news.prodigy.com!newscon04.news.prodigy.com!prodigy.com!howland.erols.net!uninett.no!ntnu.no!randhol+abuse From: randhol+abuse@pvv.org (Preben Randhol) Newsgroups: comp.lang.ada Subject: Re: Types vs subtypes Date: 29 Aug 2000 06:06:45 GMT Organization: Norwegian university of science and technology Message-ID: References: <39a9d2b0@duster.adelaide.on.net> <39AAF3AB.3E5EE43E@ix.netcom.com> NNTP-Posting-Host: kiuk0156.chembio.ntnu.no X-Trace: kopp.stud.ntnu.no 967529205 20426 129.241.83.82 (29 Aug 2000 06:06:45 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: 29 Aug 2000 06:06:45 GMT User-Agent: slrn/0.9.6.2 (Linux) Xref: supernews.google.com comp.lang.ada:384 Date: 2000-08-29T06:06:45+00:00 List-Id: On Mon, 28 Aug 2000 16:20:11 -0700, Richard Riehle wrote: > >This is something that comes up a lot in my Ada classes. I try to explain it >this way: > >A type has > 1) a name > 2) a set of operations > 3) a set of values > 4) a wall between objects of itself and objects of other >types with differing type names > >The last item, " a wall" is important in distinguishing structural equivalence >from name equivalence in the >Ada type system. > >A subtype has > > 1) a name > 2) a parent type > 3) the set of operations of its parent type > 4) either the same set of values of its parent type or a >constrained set of values > 5) no wall between operations between itself and its >parent type > 6) no wall between itself and other subtypes derived from >its parent or from itself > >A subtype is structurally equivalent to its parent type and its subtype >siblings, but may have a smaller >range of legal values. Yes. I like to look at it in this (rough) way in accordance with the syntax : type Height is new Integer; -- ^^^^^^ -- Think of it as a new type. subtype Height is Integer; -- ^^ -- Think of it as it _is_ Integer type and not a new one. -- Preben Randhol - Ph.D student - http://www.pvv.org/~randhol/ "i too once thought that when proved wrong that i lost somehow" - i was hoping, alanis morisette